Jump to content

[SOLVED] Parse Error in duplicate PHP


NickG21

Recommended Posts

Hey guys, i keep receiving this parse error of:

 

Parse error: syntax error, unexpected '"' in /.../order.php on line 13

 

Line 13 is as follows:

 

  	/*Get Products from Cart*/
Line 13:	$SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID = '" . $_COOKIE["PHPSESSID"] . "'";
$rsSQLCuCart = mysql_query($SQLCuCart);
echo $SQLCuCart;

 

The real issue im having is that im using the exact same query on the page before which is a type of "Order Overview" page and everything is working perfectly.  I have been using this same method of querying throughout this project and it has worked fine the entire way until i made this order.php page.

Any insight would be excellent,

thank you,

NickG

Link to comment
Share on other sites

Here's the entire page;

<?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
include("header.inc.php");
foreach ($_POST as $key => $value) {
    $$key = $value;
    echo $$key;
  }
/*Update tblCustomer with CC Information*/
$sqlCCUpdate = "UPDATE tblCustomer set CuCCType = '" . $CCardType . "', CuCCNum = '" . $CCNum . "', CuCCSVC = '" . $CCCSV . "', CCExpDate= '" . $CCYear . "',CCName='" . $CCName . '" WHERE CuSessID = "' . $_COOKIE['PHPSESSID'] . '";
  	echo $sqlCCUpdate;
  	$rssqlCCUpdate = mysql_query($sqlCCUpdate);
  	
  	/*Get Products from Cart*/
Line 17 Error Line:     $SQLCuCart = "SELECT CartPrID, CartPrQty from tblCart Where CartSessionID = '" . $_COOKIE['PHPSESSID'] . "'";
	$rsSQLCuCart = mysql_query($SQLCuCart) or die("Query Unsuccesful using CartSessION");
	echo $SQLCuCart;
?>

<div id="content">
<table>
<?php
while($PrIDs = mysql_fetch_array($rsSQLCuCart)){
		$PrID = $PrIDs['CartPrID'];
		$ProdSQL = "SELECT PrName,PrImage,PrPrice from tblProduct where PrID ='$PrID'";	
		$rsProdSQL = mysql_query($sql) or die("No PrID associated");
		while($row = mysql_fetch_array($result)){
        		echo $row['PrName'];
			}
		}	



	?>
</table>
</div>		
<?php include("footer.inc.php"); ?>

Link to comment
Share on other sites

also i've tried other syntax for the same query that seemed to go through and i would get either an UNEXPECTED_T_STRING on the same line or the same Parse error on line 27, the query inside the while{} loop

thanks for your help,

Link to comment
Share on other sites

This line

 

$sqlCCUpdate = "UPDATE tblCustomer set CuCCType = '" . $CCardType . "', CuCCNum = '" . $CCNum . "', CuCCSVC = '" . $CCCSV . "', CCExpDate= '" . $CCYear . "',CCName='" . $CCName . '" WHERE CuSessID = "' . $_COOKIE['PHPSESSID'] . '";

 

should be

 

$sqlCCUpdate = "UPDATE tblCustomer set CuCCType = '" . $CCardType . "', CuCCNum = '" . $CCNum . "', CuCCSVC = '" . $CCCSV . "', CCExpDate= '" . $CCYear . "',CCName='" . $CCName . '" WHERE CuSessID = '" . $_COOKIE['PHPSESSID'] . "'";

 

You had the single and double quotes the wrong way round and you needed the closing double quote.

 

EDIT: same problem in the query above it

Link to comment
Share on other sites

first query fixed

 

$sqlCCUpdate = "UPDATE tblCustomer set CuCCType = '" . $CCardType . "', CuCCNum = '" . $CCNum . "', CuCCSVC = '" . $CCCSV . "', CCExpDate= '" . $CCYear . "',CCName='" . $CCName . "' WHERE CuSessID = '" . $_COOKIE['PHPSESSID'] . "'";

 

edit: oops... try now

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.