dourun2990 2017-04-06 11:08 采纳率: 100%
浏览 535
已采纳

SQL语法; 检查与MariaDB服务器版本对应的手册[关闭]

I'm getting the following SQL error:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near `classxii`.`email`='rajdeep@gmail.com', `classx`.`email`='rajdeep@gmail.com' at line 5

My PHP code looks like:

$sql = "UPDATE `graduation`, `classxii`, `classx` SET `university`='$university', `college`='$college', `course`='$course', `branch`='$branch', `year`='$year', 
`school1`='$school1', `board1`='$board1', `percentage1`='$percentage1', `year1`='$year1', 
`school2`='$school2', `board2`='$board2', `percentage2`='$percentage2', `year2`='$year2' 
WHERE `graduation`.`email`='$email', `classxii`.`email`='$email', `classx`.`email`='$email'";

$res = mysql_query($sql) or die(mysql_error());

What could be the issue here?

  • 写回答

1条回答 默认 最新

  • doumibi6899 2017-04-06 11:13
    关注

    You need to change commas to AND in your where part of the statement:

    WHERE `graduation`.`email`='$email' AND `classxii`.`email`='$email' AND `classx`.`email`='$email'";
    

    Or if searching only one of them use OR:

    WHERE `graduation`.`email`='$email' OR `classxii`.`email`='$email' OR `classx`.`email`='$email'";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?