webio Posted October 12, 2010 Share Posted October 12, 2010 Hello, can someone point me direction why this code: <?php function free_account_upgrade($vars) { $invoiceid = $vars['invoiceid']; $sql_order_num = "SELECT id FROM tblorders WHERE invoiceid = '$invoiceid'"; $rs_order_num = mysql_query($sql_order_num); while($row = mysql_fetch_array($rs_order_num, MYSQL_ASSOC)){ $order_num = $row["id"]; } $sql_hosting_num = "SELECT id FROM tblhosting WHERE orderid = '$order_num'"; $rs_hosting_num = mysql_query($sql_hosting_num); while($row = mysql_fetch_array($rs_hosting_num, MYSQL_ASSOC)){ $hosting_num = $row["id"]; } echo($invoiceid." ".$order_num." ".$hosting_num); update_query("tblhosting",array("notes"=>"Upgrade"),array("id"=>$hosting_num)); delete_query("tblcancelrequests","relid='".$hosting_num["id"]."'"); } add_hook("InvoiceCreationPreEmail",1,"free_account_upgrade"); ?> is not fetching any data from MySQL? I was trying many many other variations with select_query too. Everytime MySQL is not returning anything. Thank you 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted October 12, 2010 Share Posted October 12, 2010 Are you sure that the hook is returning an array for the invoice ID? being that its only 1 var that gets passed to it, its possible that its not an array at all. Either way, I'd add some debugging code to print out the invoice ID so you can verify that its being passed properly. Other than that, the code looks like. As stated in your post, you should use select_query() where applicable. Also, try turning on display_errors in your configuration.php to make sure its not something silly like a newline after the closing ?> Hope this helps! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.