$upbalance = mysql_query("SELECT accountbalance FROM probid_users WHERE id='".$_POST['auctionid']."'"); if ($maxbid<=$upbalance) { $nbalance = $upbalance - $maxbid; $insertnewbalance = mysql_query("UPDATE probid_users SET accountbalance='$nbalance' WHERE id='".$_SESSION['memberid']."'"); }
For some reason I don't know my database won't update the "accountbalance"
and yes $maxbid is defined and that's fine along with .$_POST['auctionid'].
PHP Code:
$insertnewbalance = mysql_query("UPDATE probid_users SET accountbalance='$nbalance' WHERE id='".$_SESSION['memberid']."'");
This is really the line that's causing problems...
Please read the manual and tell me what does mysql_query() return. Then tell me what is the value of $upbalance after calling mysql_query() in your case. After that you probably should resolve your problem.
Your $upbalance variable is merely a resource and cannot be used in a conditional statement. You need to use a mysql_fetch function to return an array and then use this array to extract the id value.
PHP Code:
$upbalance = mysql_query("SELECT accountbalance FROM probid_users WHERE id='".$_POST['auctionid']."'"); $row = mysql_fetch_assoc($upbalance);