代码:您的SQL语法有错误;检查对应于你的MySQL服务器版本正确的语法使用手动附近的视角
$sql = "
INSERT INTO book
(id
, account_no
, admin_id
, title
, author
, edition
, book_publisher
, book_copies
, book_isbn
, print_place
, book_year
, book_pages
, book_price
, entry_date
) VALUES
(''
, '$account_id'
, '$admin_id'
, '$title'
, '$author'
, '$edition'
, '$publisher'
, '$copies'
, '$isbn'
, '$place'
, '$year'
, '$pages'
, '$price'
, '$date'
)
";
在使用此查询我收到此错误插入数据:
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 's Perspective','Randal E. Bryant','2','Prentice Hall','2','978-0136108047','USA'' at line 3
任何人都可以告诉如何解决这个错误?
注射攻击仍然发生,你有危险 – 2014-10-08 08:20:00
显然有一些v就像'Someone's Perspective'那样会破坏查询。使用PDO,预处理语句,转义数据等。 – 2014-10-08 08:21:46
您确定ID列未在数据库中设置为auto_increment吗?如果是,则从表格和值列表中排除。 – 2014-10-08 08:22:45