lilseeam Posted August 11, 2013 Share Posted August 11, 2013 Can someone please help me figure out how to store customer payment info into a databse. below is the sricpt i have written but i am not able to get the infomation into the database so i see the information for completed, pending, failed and cancel. $invoice->getStatus(); $invoice->getCustomData("ticketnum"); if($invoice->getStatus()=="completed") { $qry='update pcustomerorder set flag = "1" where pcustomerorderid ="'.$_SESSION["orderid"].'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); } /*else if($invoice->getStatus()=="pending") { $qry='update pcustomerorder set flag = "2" where pcustomerorderid ="'.$orderid.'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); }*/ else if($invoice->getStatus()=="canceled") { $qry='update pcustomerorder set flag = "0" where pcustomerorderid ="'.$_SESSION["orderid"].'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); } else if($invoice->getStatus()=="fail") { $qry='update pcustomerorder set flag = "0" where pcustomerorderid ="'.$_SESSION["orderid"].'"'; $result=mysql_query($qry); header("Location: userprofile.php?msg=".$invoice->getStatus()); } Quote Link to comment https://forums.phpfreaks.com/topic/281053-issue-with-database/ Share on other sites More sharing options...
davidannis Posted August 11, 2013 Share Posted August 11, 2013 (edited) I would check the following: see what the getStatus function is returning. Make sure it is returning the expected value. You should see it in the URL that header sends you to. echo the $qry and try to run the SQL directly against the database (use phpMyadmin perhaps) and see if it executes correctly. Edited August 11, 2013 by davidannis Quote Link to comment https://forums.phpfreaks.com/topic/281053-issue-with-database/#findComment-1444425 Share on other sites More sharing options...
davidannis Posted August 11, 2013 Share Posted August 11, 2013 Another couple of suggestions unrelated to your question: use the code tags around code you post in the forum (the <> symbol in the editor) in SQL use all CAPS for the reserved words like UPDATE, SET, WHERE (makes things easier to read) given a choice use mysqli instead of mysql Quote Link to comment https://forums.phpfreaks.com/topic/281053-issue-with-database/#findComment-1444427 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.