Jump to content

database code below causing 'unexpected $end'


scotch33

Recommended Posts

Hi,

I am trying to write to a database using the code below.  however when this code is in the page I am getting the following error -

Parse error: syntax error, unexpected $end in /home/c/m/cmsinstituteofli/public_html/bespokepay2/completed.php on line 78

where the line '78' is in fact the closing tag of the html. 

If I remove the code, the page works fine.  Can anyone help


<?
$connector = mysql_connect('localhost', '[USERNAME]', '[PASSWORD]');
mysql_select_db('[DATABASENAME]', $connector);

$randcode = md5(rand(1,9999).time().str_shuffle("qwertyuiop12345"));
$invoiceno = $_COOKIE[invoiceno];
$amount = $_COOKIE[amount];
$name = $_COOKIE[name];
$email = $_COOKIE[email];
$phone = $_COOKIE[phone];
$companyname = $_COOKIE[companyname];
$billingaddress = $_COOKIE[billingaddress];
$billingpostcode = $_COOKIE[billingpostcode];
$addresschange = $_COOKIE[addresschange];

$sql_insert = "INSERT INTO payment_records SET
rand_code='$randcode'
invoiceno='$invoiceno',
amount='$amount',
name='$name',
email='$email',
phone='$phone',
companyname='$companyname',
billingaddress='$billingaddress',
billingpostcode='$billingpostcode',
addresschange='$addresschange'";
if (@mysql_query($sql_insert)) {
    echo "Thank you for your order <br />A receipt has been sent to your e-mail address.<br />The order process is now finished.";
$result =  mysql_query("SELECT * FROM payment_records WHERE randcode='$randcode'");
if (!$result) {
exit('<p>error performing query:'.mysql_error().'</p>');
}
$row = mysql_fetch_array($result);
?>

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.