Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP解析错误:语法错误,意外';更新';(T_字符串)_Php_Parsing - Fatal编程技术网

PHP解析错误:语法错误,意外';更新';(T_字符串)

PHP解析错误:语法错误,意外';更新';(T_字符串),php,parsing,Php,Parsing,?> 我得到一个错误: $result1 = mysql_query("Select * from tbl_lastLocation where driver_id='$user_id'); if(mysql_num_rows($result1)){ $result2 = mysql_query("UPDATE tbl_lastLocation SET Latitude='$Latitude',Longtitude='$Longitude',vehicle_id='$vehicle_id

?>

我得到一个错误:

$result1 = mysql_query("Select * from tbl_lastLocation where driver_id='$user_id');
if(mysql_num_rows($result1)){
    $result2 = mysql_query("UPDATE tbl_lastLocation SET Latitude='$Latitude',Longtitude='$Longitude',vehicle_id='$vehicle_id',data_create='$date_create',time_create='$time_create' WHERE driver_id='$user_id'"); //line 17
}
else{
    $result2 = mysql_query("INSERT INTO tbl_lastLocation (driver_id,vehicle_id,Latitude,Longtitude,data_create,time_create) VALUES ('$user_id','$vehicle_id','$Latitude','$Longitude','$date_create','$time_create')");
}

$data["result"] = "1";

    echo json_encode($data);
错误的含义是什么?如何修复它

PHP Parse error:  syntax error, unexpected 'UPDATE' (T_STRING) in /home/barbodpl/public_html/its_api/lastlocation.php on line 17
这缺少结束语“因此应:

 $result1 = mysql_query("Select * from tbl_lastLocation where driver_id='$user_id');

Mysql函数已被弃用,请使用MySQLi和prepared语句,因为您的查询看起来容易被注入。

missing“在第一个SQLSQL结尾处,
Mysql
PHP扩展已失效--停止使用。它很旧,从PHP5.5开始就被弃用,在PHP7.0中被完全删除。使用或代替。阅读答案,了解更多有关原因和方式的信息。是的,谢谢
$result1 = mysql_query("Select * from tbl_lastLocation where driver_id='$user_id'");