I am getting data from couple of queries in a php page. All the loops and queries are working perfectly but I am getting error in the following one.
ERROR ONE:
$sql_pso_sign="SELECT * FROM Table";
$rs_pso_sign=odbc_exec($conn,$sql_pso_sign);
if (!$rs_pso_sign) {
exit("Error in SIGNATURE TABLE INFO SQL");
}
while (odbc_fetch_row($rs_pso_sign)) {
$psoName = odbc_result($rs_pso_sign, "NAME");
$psoSign = odbc_result($rs_pso_sign, "SIGNATURE");
$psoDate = odbc_result($rs_pso_sign, "DATE");
}
echo $psoName;
the error is Undefined variable: pso_name;
I have copied it from same page other loops which work fine. the working one on same page is
$sql_items="SELECT * FROM Table2";
$rs_items=odbc_exec($conn,$sql_items);
if (!$rs_items) {
exit("Error in table2 SQL");
}
while (odbc_fetch_row($rs_items)) {
$calc = odbc_result($rs_items, "ITEMS_CALC");
$dsd = odbc_result($rs_items, "ITEMS_DSD");
$wrs = odbc_result($rs_items, "ITEMS_WRS");
$specs = odbc_result($rs_items, "ITEMS_SPECS");
$ochk = odbc_result($rs_items, "ITEMS_OTHERS");
$otxt = odbc_result($rs_items, "ITEMS_OTHERS_TXT");
}
echo $calc;
it has become really frustrated I've deleted and pasted same while loops from others and I've put echo checks which do not echo inside while loop of first query.
Any suggestions?
ACTUAL CODE:
$sql_pso_sign="SELECT * FROM SIGNATURES_DASO WHERE DASO_NO ='".$daso_no."'";
$rs_pso_sign=odbc_exec($conn,$sql_pso_sign);
if (!$rs_pso_sign) {
exit("Error in SIGNATURE TABLE INFO SQL");
}
while (odbc_fetch_row($rs_pso_sign)) {
$psoName = odbc_result($rs_pso_sign, "NAME");
$psoSign = odbc_result($rs_pso_sign, "SIGNATURE");
$psoDate = odbc_result($rs_pso_sign, "DATE");
}
echo $psoName;
The $daso_no has value in it and i have checked the query is correct
$psoName
and not$pso_name;
and that's the error you're seeing – Hanky 웃 Panky Jul 30 at 7:15