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
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.

Edited by davidannis
Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.