-2
<?php
if(isset($_POST['update']))
$dbhost = 'localhost';
$dbuser = 'XXXXX';
$dbpass = 'XXXXX';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
  die('Could not connect: ' . mysql_error());
}

if(! get_magic_quotes_gpc() )
{
 $OrderID=addslashes ($_POST['OrderID']); 
 $trackingnumber= addslashes ($_POST['trackingnumber']);
 $trackingURL=addslashes ($_POST['trackingURL']); 
 $CustomerName=addslashes ($_POST['CustomerName']); 
 $LocationShipped=addslashes ($_POST['LocationShipped']); 
 $user_email=addslashes ($_POST['user_email']); 
 $ShipmentDate=addslashes ($_POST['ShipmentDate']);
 $ShipmentMode=addslashes ($_POST['ShipmentMode']);  
 $CurrentStatus=addslashes ($_POST['CurrentStatus']);
}
else
{
 $trackingnumber= $_POST['trackingnumber'];
 $trackingURL=$_POST['trackingURL']; 
 $OrderID=$_POST['OrderID']; 
 $CustomerName=$_POST['CustomerName']; 
 $user_email=$_POST['user_email']; 
 $LocationShipped=$_POST['LocationShipped']; 
 $ShipmentDate=$_POST['ShipmentDate'];
 $ShipmentMode=$_POST['ShipmentMode'];  
 $CurrentStatus=$_POST['CurrentStatus'];
}

$sql = "
    UPDATE
        ordertracking
    SET
        trackingnumber =$trackingnumber,
        `trackingURL` = '" . $trackingURL . "',
        `CustomerName` = '" . $CustomerName . "',
        `LocationShipped` = '" . $LocationShipped . "',
        `user_email` = '" . $user_email . "',
        `ShipmentDate` = '" . $ShipmentDate . "',
        `ShipmentMode` = '" . $ShipmentMode . "',
        `CurrentStatus` = '" . $CurrentStatus . "',
    WHERE
        OrderNo = $OrderID,

$result1 = mysql_query($query1);
mysql_select_db('XXXXXXX');
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
  die('Could not enter data: ' . mysql_error());
}
echo "Entered data successfully\n";
mysql_close($conn);
?>

解析エラー: /home/buyerhel/public_html/ordertracking/backend/processeditship.php の 46 行目に構文エラー、予期しない T_STRING があります

何か助けてください?

何が問題なのかわかりませんが、プロジェクトの編集セクションの最後のステップにあり、テーブルを更新できるので、本当にイライラします。ここでは意図的に引用符を省略しました - trackingnumber =$trackingnumber, だからそれは問題ではありません..

4

4 に答える 4

2

に終了記号はありませ"$sql。次のようにする必要があります。

$sql = "
    UPDATE
        ordertracking
    SET
        trackingnumber =$trackingnumber,
        `trackingURL` = '" . $trackingURL . "',
        `CustomerName` = '" . $CustomerName . "',
        `LocationShipped` = '" . $LocationShipped . "',
        `user_email` = '" . $user_email . "',
        `ShipmentDate` = '" . $ShipmentDate . "',
        `ShipmentMode` = '" . $ShipmentMode . "',
        `CurrentStatus` = '" . $CurrentStatus . "'
    WHERE
        OrderNo = $OrderID"; // < missing ";
于 2013-05-23T12:47:36.570 に答える