Jump to content

UPDATE query not updating row? You have to refresh browser to get it to work.


Presto-X

Recommended Posts

Hello everyone,

 

This one has me stumped, I have a thank you page that you get to after submitting a pay by check  checkout form, this page is has 3 parts to and the first 2 are working great.

 

[*]When the page starts it loads site contact information from the database and the customers contact information from POST... WORKING

[*]Then it sends 2 emails one for the customer and another to the site owner... WORKING

[*]Then it updates the customer’s account in the database, this is where it stops working. The page loads fine but I have to wait for 2-3 seconds then hit the browsers refresh button for it to submit the query.

 

What can I do to test this more and find out what is causing this, I have never had a problem where it did not want to update on the first try… very odd.

 

/*
// Site Information
$sql = "SELECT name, address, suburb, state, postcode, telephone, email_to FROM ".$mosConfig_dbprefix."contact_details WHERE id='1'";
$result = mysql_query($sql);
$i = mysql_fetch_row($result);
define("SITENAME", $i[0]);
define("SITEADDRESS", $i[1]);
define("SITECITY", $i[2]);
define("SITESTATE", $i[3]);
define("SITEZIP", $i[4]);
define("SPHONE", $i[5]);

// Submited Student Information
define("SEMAIL", $_POST['site_email']);
define("USERID", $_POST['ssl_customer_code']);
define("DATEID", $_POST['dateid']);
define("NAME", $_POST['ssl_first_name']);
define("DATE", $_POST['DATE']);
define("EMAIL", $_POST['ssl_email']);
define("COMPANY", $_POST['ssl_company']);
define("ADDRESS", $_POST['ssl_avs_address']);
define("CITY", $_POST['ssl_city']);
define("STATE", $_POST['ssl_state']);
define("ZIP", $_POST['ssl_avs_zip']);
define("PHONE", $_POST['ssl_phone']);
define("FAX", $_POST['fax']);
define("CATTITLE", $_POST['cattitle']);
define("AMOUNT", $_POST['ssl_amount']);
define("STARTDATE", $_POST['coursestartdate']);

  // Send Message To Site Owner
  $subject  = "New Student Signed Up! (Check Payment!)" . "\r\n";
  $message   = "A new student has signed up for the <strong>".CATTITLE."</strong> on <strong>".STARTDATE."</strong>.<br /><br />" . "\r\n";
   $message .= "<strong>Student's Contact Information:</strong><br />" . "\r\n";
   $message .= COMPANY."<br />" . "\r\n";
   $message .= NAME."<br />" . "\r\n";
   $message .= ADDRESS."<br />" . "\r\n";
   $message .= CITY.", ".STATE." ".ZIP."<br />" . "\r\n";
   $message .= PHONE."<br />" . "\r\n";
   $message .= FAX."<br />" . "\r\n";
   $message .= "<a href=\"mailto:".EMAIL."\">".EMAIL."</a><br /><br />" . "\r\n";
   $message .= "<b>Billing Information:</b><br />" . "\r\n";
   $message .= "Payment Type: Check<br />" . "\r\n";
   $message .= "Invoice# ".USERID."<br />" . "\r\n";
   $message .= "Price: $".AMOUNT."<br />" . "\r\n";
  $headers   = "MIME-Version: 1.0" . "\r\n";
   $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
   $headers .= "From: Wilderness Rescue International <[email protected]>\r\n";
  mail(SEMAIL,$subject,$message,$headers);

  // Send Message To Student
  $subject  = "Thank you for signing up with us!" . "\r\n";
  $message   = "<h1>Invoice: ".USERID."</h1>" . "\r\n";
   $message .= "Hello ".NAME.",<br /><br />" . "\r\n";
   $message .= "Thank you ".NAME." for registering with us for our ".CATTITLE.". Make sure to write the invoice number (<strong>".USERID."</strong>) on the check's memo line. Please send your payment of <strong>$".AMOUNT."</strong>, to the address below to complete your registration.<div style=\"margin-left:25px;\"><strong>".SITENAME."<br />".SITEADDRESS."<br />".SITECITY.", ".SITESTATE." ".SITEZIP."</strong></div><br />" . "\r\n";
   $message .= "---------------------------------------------<br />" . "\r\n";
   $message .= "<b>Billing Information:</b><br />" . "\r\n";
   $message .= "Payment Type: Check<br />" . "\r\n";
   $message .= "Invoice# ".USERID."<br />" . "\r\n";
   $message .= "Price: $".AMOUNT."<br />" . "\r\n";
   $message .= "---------------------------------------------<br /><br />" . "\r\n";
   $message .= "Sincerely,<br />" . "\r\n";
   $message .= SITENAME."<br />" . "\r\n";
   $message .= SITEADDRESS."<br />" . "\r\n";
   $message .= SITECITY.", ".SITESTATE." ".SITEZIP."<br />" . "\r\n";
   $message .= SPHONE."<br />" . "\r\n";
   $message .= "<a href=\"mailto:".SEMAIL."\">".SEMAIL."</a><br />" . "\r\n";
   $message .= "<a href=\"http://www.wilderness-rescue.com\">www.wilderness-rescue.com</a><br />" . "\r\n";
  $headers   = "MIME-Version: 1.0" . "\r\n";
   $headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
   $headers .= "From: ".SITENAME." <".$SEMAIL.">" . "\r\n";
   $headers .= "From: Wilderness Rescue International <[email protected]>\r\n";
  mail(EMAIL,$subject,$message,$headers);

echo "Thank you ".NAME." for registering with us for our ".CATTITLE.". Make sure to write the invoice number (<strong>".USERID."</strong>) on the check's memo line. Please send your payment of <strong>$".AMOUNT."</strong>, to the address below to complete your registration.<div style=\"margin-left:25px;\"><br /><strong>".SITENAME."<br />".SITEADDRESS."<br />".SITECITY.", ".SITESTATE." ".SITEZIP."</strong></div>" . "\r\n";
*/
  // Update User's Account:: Set Their Status to Active
  $updateAccount = "UPDATE ".$mosConfig_dbprefix."courses_roster SET status='1' WHERE id='".$_POST['ssl_customer_code']."'";
  mysql_query($updateAccount);

lets see what you're actually doing the firs time round....

 

change this line

 

mysql_query($updateAccount);

 

to this so we can see if there's an error and have a look at the query;

 

<?php
echo "$updateAccunt<br /><br />";
mysql_query($updateAccount) or die("MySQL Error: ".mysql_error());

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.