SQL语句报错: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

报错如图:

最开始其实我的列名tname和tsubject分别叫name和subject,后来看到网上有说这个报错可能是数据库建表的时候使用了mysql的关键词,我就只把name改了。后来还是这个问题,百思不得其解。

后来同学告诉我说老师帮她检查SQL语句的问题时都是把php程序里的SQL语句先复制到mysql里面去执行看是不是数据库的问题的。

太tm机智了,我怎么没想到呢,姜还是老的辣。复制过去一看,怎么subject也是关键词啊! 很有信心的改掉以后等待正确结果,但是竟然还是这个错。。。

没关系,小场面。

后来我又是在数据库里面各种试,一次误操作int类型的那列给搞了个字符串然后插入失败。瞬间恍然大悟。把$age=$_POST[‘age‘];改成了$age=(int)$_POST[‘age‘];。然后果然就成功插入了。。。。

可是很奇怪,我之前写php并没有强制这样转换过也插入成功了啊,而且同学也没有这个操作,难道是版本问题???奇怪。。。。

原文地址:https://www.cnblogs.com/littleLittleTiger/p/11029420.html

时间: 2024-07-31 12:35:25

SQL语句报错: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的相关文章

插入mysql语句报错:1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

插入一个很简单的sql语句时候,mysql一直报错: [SQL] INSERT INTO ORDER ( id, activity_id, order_type, phone, order_amount, order_state, pay_type)VALUES ( '4', '2121313', '1', '13552444989', '1', '1', '1' ) [Err] 1064 - You have an error in your SQL syntax; check the man

MySql 执行语句错误 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

关于用Power Designer 生成sql文件出现 错误  [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'int not null auto_increment comment '用户id', 的解决办法 sql语句如下 1 drop table

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?,?)'

使用?占位符写MYSQL查询语句,执行报错 1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?,?)' at line 1 2 at sun.ref

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where id = 2' at line 8

字典管理修改接口测试传了id后出现: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where id = 2' at line 8 百度翻译:您的SQL语法有错误:请查阅与您的MySQL服务器版本相对应的手册,以获得在第8行“where id=2”附近使用的正确语法. 百度解

MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':ge

数据库表里命名有这个字段,可怎么就是报错呢,大神的解释: 加上之后立马好用!!! MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':ge

MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...

下面是我update数据库时打印出来的异常: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea

C# Mysql You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ????

有几年没用过MySql数据了,今天在使用C#访问MySql数据库时出现了一个小插曲. 错误提示: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ??? 当然,错误提示已经很明白的说明是sql的语法错误. 然而,我的sql 语句是 select count(*) from tab

解决You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (order_name, customer)

在学习hibernate一对多映射关系时,根据视频学习的时候,例子是顾客和订单的问题,一个顾客有多个订单.按照视频中的敲代码出现了You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order (order_name, customer) 原因是order是mysql关键字,不能做

Mysql错误:[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 如果不是符号中英文切换的问题,那就是反引号写成单引号引起的  参考链接:https://blog.csdn.net/qq_27495157/article/details/80240156 原文地址:htt