Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Error fetching array (mysql)


Sweetie - 11:52 am on Feb 5, 2013 (gmt 0)


Hello!
Here the code:

$db->query("SELECT * FROM bill_temp WHERE user_id='".$usrid."'");
// Check if have rows
if($db->numrows() != 0)
{
while($row = $db->getRows())
{
$txn_id = $row['num_bill'];
}
foreach($q->billStatus($txn_id,TRUE) as $idbill=>$v)
{
$mp = $v['amount'];
if($v['status'] == 60)
{
$db->query("SELECT amount FROM bill_temp WHERE user_id='".$usrid."' AND num_bill='".$idbill."'");
while($row = $db->getRows()) $moneyCheck = $row['amount'];
// Amount checking
if($moneyCheck == $mp)
{
//some code
}
else {
//some code
}
}
if($v['status'] > 100)
{
//some code
}
}
}
else
echo ('numrows == 0');

But code fails at: $txn_id = $row['num_bill'];
Undefined index: num_bill (in this line: $txn_id = $row['num_bill'];)
Here the var_dump($row):
array(1) { [0]=> array(3) { ["user_id"]=> string(1) "1" ["num_bill"]=> string(8) "s7M1RxCf" ["amount"]=> string(2) "11" } }

What's wrong in code?


Thread source:: http://www.webmasterworld.com/php/4542494.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com