SkyRanger Posted January 11, 2013 Share Posted January 11, 2013 I am trying to insert then update 2 different tables and I am lost on how to do so, any ideas? $payer_email = mysql_real_escape_string($_POST['payer_email']); $mc_gross = mysql_real_escape_string($_POST['mc_gross']); $sql = "INSERT INTO orders VALUES (NULL, '$txn_id', '$payer_email', $mc_gross)"; $sql = "update users set ctype='3' where email='$payer_email'"; if (!mysql_query($sql)) { error_log(mysql_error()); exit(0); } I can get it to update but not insert Quote Link to comment https://forums.phpfreaks.com/topic/273032-insertupdate/ Share on other sites More sharing options...
requinix Posted January 11, 2013 Share Posted January 11, 2013 You set $sql and then you overwrite it on the very next line. Quote Link to comment https://forums.phpfreaks.com/topic/273032-insertupdate/#findComment-1405025 Share on other sites More sharing options...
SkyRanger Posted January 11, 2013 Author Share Posted January 11, 2013 Thank you for the second set of eye's fixed the problem. Quote Link to comment https://forums.phpfreaks.com/topic/273032-insertupdate/#findComment-1405027 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.