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
https://forums.phpfreaks.com/topic/167001-solved-parse-error-in-duplicate-php/
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"); ?>

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

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

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.