Php 我有一个错误:检查与MySQL服务器对应的手册
我不断得到错误: 错误:您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以了解第1行“WHERE order_id=100038”附近要使用的正确语法 我的代码的上半部分,问题应该是:Php 我有一个错误:检查与MySQL服务器对应的手册,php,mysql,Php,Mysql,我不断得到错误: 错误:您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以了解第1行“WHERE order_id=100038”附近要使用的正确语法 我的代码的上半部分,问题应该是: $id = $_GET["Ref"]; $state = 'Geannuleerd'; if (!empty($id)){ $con= mysqli_connect("**********","************","**************","
$id = $_GET["Ref"];
$state = 'Geannuleerd';
if (!empty($id)){
$con= mysqli_connect("**********","************","**************","**************");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$updquery = "UPDATE order SET order_state = '$state', WHERE order_id = $id";
$updresult = mysqli_query($con, $updquery);
if (!$updresult) {
printf("error: %s\n", mysqli_error($con));
}
mysqli_free_result($updresult);
$mailquery = "SELECT * FROM order WHERE order_id ='". $id. "'";
$mailresult = mysqli_query($con, $mailquery);
if (!$mailresult) {
printf("error: %s\n", mysqli_error($con));
}
就像我看到的一样,UPDATE语句的语法是错误的。精选的作品完美
谢谢你的帮助 删除WHERE语句之前的逗号
$updquery=“更新订单集订单状态=“$state”,其中订单id=$id”代码>在的位置之前,逗号在那里做什么?错误应该是“检查SQL注入手册”n_n@pleasedontbelong:我还没有到目前为止,仍在学习:)但到目前为止我学到的是,当页面上没有输入框时(如我的示例中),注入不是很困难吗?