PHP与MYSQL; SQL语法错误

时间:2012-01-30 13:56:22

标签: php mysql sql

我一直收到以下SQL语法错误:

错误消息

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 'desc, tag ) VALUES( '1', '1', '1', 'Jakis pis', 'Jakis tag')' at line 1Query failed

MYSQL QUERY:

$qry = "INSERT INTO lang".$lang." ( lang, submenu, live, desc, tag ) VALUES( '$lang', '$submenu', '$live', '$desc', '$tag') ";

的print_r($ QRY);

完整SQL查询:INSERT INTO lang1 ( lang, submenu, live, desc, tag ) VALUES( '1', '1', '1', 'Some desc', 'Some tags')

我多次检查了表名和列名,你能看到任何语法错误吗?

1 个答案:

答案 0 :(得分:10)

尝试:

  ( `lang`, `submenu`, `live`, `desc`, `tag` )

因为desc是MySQL reserved word