PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
function pay_instructor($amount){
// aj - Add commission to referring instructors account in com_profiler table
$qry = "UPDATE jos_comprofiler SET accountbal = accountbal + ". $amount ." WHERE id = '" . $_COOKIE['refidC'] . "'";
mysql_query($qry);
}
As far as I can tell, everything is correct... Just to be sure I tried calling the function in another php file (my registration page) and it updated fine. Any suggestions??
Presumably you have ECHOed the variable to check the contents are correct. Is your table field the right type? Personally I would write your query like this as I find it clearer (I would transfer the COOKIE data to a normal variable first):
mysql_query($qry) or die("Query to update the account balance failed with this err: ".mysql_error());
Then you will get a message (unless errors are turned off) which tells you what the problem is. Remember to remove the OR DIE bit before deploying the page to users.