Jump to content

[SOLVED] Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE error


NickG21

Recommended Posts

Hey Everyone,

Could someone tell me if im getting this error because of a syntax error or possibly because there is an empty variable?  And if an empty variable could someone tell me how to error check for this now and in the future?

thanks in advance for any help

Nick

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/alloutd1/public_html/test/YourLife/checkout2.php on line 20

<?php
include("header.inc.php");
$CuID = $_COOKIE['PHPSESSID'];
/*Get Customer Info*/
$SQLUser = "SELECT * from tblCustomer Where CuBillAddress ='" . $_GET['addr'] . "' AND CuEmail='" . $_GET['email'] . "'";
$rsSQLUser = mysql_query($SQLUser);
	$CuInfo = mysql_fetch_array($rsSQLUser);
/*Get Products from Cart*/
$SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID ='" . $_GET['id'] . "'";
$rsSQLCuCart = mysql_query($SQLCuCart);
if(isset($_POST['order'])){
	/*Get Customer Info*/
		$SQLUser = "SELECT * from tblCustomer Where CuBillAddress ='" . $_GET['addr'] . "' AND CuEmail='" . $_GET['email'] . "'";
		$rsSQLUser = mysql_query($SQLUser);
		$CuInfo = mysql_fetch_array($rsSQLUser);
	/*Get Products from Cart*/
		$SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID ='" . $_GET['id'] . "'";
		$rsSQLCuCart = mysql_query($SQLCuCart);
	/*Log order before individual products*/
Line 20:		$SQLOrder = "INSERT into tblOrder (OrID, OrDate, OrCuShipFName,OrCuShipLName,OrCuShipAddress,OrCuShipCity,OrCuShipState,OrCuShipZip,OrCuShipEmail,OrCuShipPhone,OrCuBillFName,OrCuBillLName,OrCuBillAddress,OrCuBillCity,OrCuBillState,OrCuBillZip,OrCuBillEmail,OrItemTotal,OrShippingTotal,OrAuthorization,OrStatus) values('',now(),'$CuInfo['CuShipFName'],$CuInfo['CuShipLName']','$CuInfo['CuShipAddress']','$CuInfo['CuShipCity']','$CuInfo['CuShipState']','$CuInfo['OrCuShipZip']','$CuInfo['OrCuShipEmail']','$CuInfo['CuShipPhone']','$CuInfo['OrCuBillFName']','$CuInfo['OrCuBillLName']','$CuInfo['OrCuBillAddress']','$CuInfo['OrCuBillCity']','$CuInfo['OrCuBillState']','$CuInfo['OrCuBillZip']','$CuInfo['OrCuBillEmail']','$_SESSION['total']','','','')";
		echo $SQLOrder;

	/*Log individual products*/
	while($row = mysql_fetch_array($rsSQLCuCart)){
		$SQLPrInfo = "SELECT * from tblProduct where PrID='" . $row['CartPrID'] . "'";
			$rsSQLPrInfo = mysql_query($SQLPrInfo);
			$PrInfo = mysql_fetch_array($rsSQLPrInfo);
			echo $PrInfo['PrID'] . "<br/>";
		/*$SQLCuOrder = "INSERT into tblOrderProduct(OpID, OpOrID, OrCartPrID, OpCartPrQty, OpPrPrice, OpPrMaker) values('$row['CartPrID']','	*/

	}

?>

Link to comment
Share on other sites

change line 20 to

		$SQLOrder = "INSERT into tblOrder (OrID, OrDate, OrCuShipFName,OrCuShipLName,OrCuShipAddress,OrCuShipCity,OrCuShipState,OrCuShipZip,OrCuShipEmail,OrCuShipPhone,OrCuBillFName,OrCuBillLName,OrCuBillAddress,OrCuBillCity,OrCuBillState,OrCuBillZip,OrCuBillEmail,OrItemTotal,OrShippingTotal,OrAuthorization,OrStatus) values('',now(),'$CuInfo[CuShipFName],$CuInfo[CuShipLName]','$CuInfo[CuShipAddress]','$CuInfo[CuShipCity]','$CuInfo[CuShipState]','$CuInfo[OrCuShipZip]','$CuInfo[OrCuShipEmail]','$CuInfo[CuShipPhone]','$CuInfo[OrCuBillFName]','$CuInfo[OrCuBillLName]','$CuInfo[OrCuBillAddress]','$CuInfo[OrCuBillCity]','$CuInfo[OrCuBillState]','$CuInfo[OrCuBillZip]','$CuInfo[OrCuBillEmail]','$_SESSION[total]','','','')";

Link to comment
Share on other sites

hey Sasa, when I use that syntax for the Insert statement, all of the field values are blank except for my Session variable, and the statement does not execute properly anyway.  When I plug in the Insert statement, even with the blank values, into a query window in PHPMyAdmin, I receive this error;

 

SQL query:

 

NSERT INTO tblOrder( OrID, OrDate, OrCuShipFName, OrCuShipLName, OrCuShipAddress, OrCuShipCity, OrCuShipState, OrCuShipZip, OrCuShipEmail, OrCuShipPhone, OrCuBillFName, OrCuBillLName, OrCuBillAddress, OrCuBillCity, OrCuBillState, OrCuBillZip, OrCuBillEmail, OrItemTotal, OrShippingTotal, OrAuthorization, OrStatus ) VALUES (

'', now( ) , ',', '', '', '', '', '', '', '', '', '', '', '', '', '', '1499.5', '', '', ''

)

 

MySQL said: Documentation

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NSERT into tblOrder (OrID, OrDate, OrCuShipFName,OrCuShipLName,OrCuShipAddress,O' at line 1

 

any ideas about this?

thanks again

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.