使用MySQL 5数据库SQL列做不到,我想与内嵌HTML数据库本身手动更新字段:MySQL的5 - 插入内嵌HTML内容转换成使用UPDATE
UPDATE employee SET bio = "<div style="text-align:center"> <H2>Employment History</H2> <table class='table' style="width:auto;margin-left:auto;margin-right:auto;"><tr><th>Year</th><th>Company</th></tr><tr><td>2013-14</td><td>IBM</td></tr><tr><td>2015-16</td><td>Microsoft</td></tr><tr><td>2016-17</td><td>Google</td></tr></table><H2>BIO</H2></div><p>John Smith started out as developer and became project manager.</p>" where ID = 100;
(顺便说一句这不是一条线 - 其被包装成多行,当我复制/粘贴它MySQL的外壳内)
结果在以下错误:
ERROR 1064 (42000): 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 'margin-left:auto' at line 1
ERROR 1064 (42000): 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 'margin-right:auto' at line 1
什么我可能做错了吗?有没有办法在UPDATE或ALTER SQL语句中使用HTML文件进行此更改?
字符串值应该用引号括起来,或者更好 - 你应该使用准备好的语句。 – Dekel