scotch33 Posted January 31, 2007 Share Posted January 31, 2007 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 78where 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 SETrand_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);?> Link to comment https://forums.phpfreaks.com/topic/36457-database-code-below-causing-unexpected-end/ Share on other sites More sharing options...
chronister Posted January 31, 2007 Share Posted January 31, 2007 you have a missing } or ?> or ' or ;take a look through and find the syntax errormaybe here $sql_insert = "INSERT INTO payment_records SETrand_code='$randcode' << need a , hereinvoiceno='$invoiceno',amount='$amount', Link to comment https://forums.phpfreaks.com/topic/36457-database-code-below-causing-unexpected-end/#findComment-173538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.