Jump to content

Issue With Database


lilseeam

Recommended Posts

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());
}
Link to comment
https://forums.phpfreaks.com/topic/281053-issue-with-database/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/281053-issue-with-database/#findComment-1444425
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/281053-issue-with-database/#findComment-1444427
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.