MySQL语法错误>。<

时间:2012-07-19 22:22:50

标签: php mysql mysql-error-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 ' 'Andrew', 'West', '***@gmail.com',
'7*7 **', '', ' at line 14

使用的代码:

    $db_insert = mysql_query("INSERT INTO catches (
        catch_affid,
        catch_firstname,
        catch_lastname,
        catch_email,
        catch_street1,
        catch_street2,
        catch_city,
        catch_state,
        catch_postalcode,
        catch_country,
        catch_contactid
    ) VALUES (
        $a,
        '$f',
        '$l',
        '$e',
        '$s1',
        '$s2',
        '$c',
        '$s',
        $p,
        '$cy',
        '$cid'
    )");

2 个答案:

答案 0 :(得分:2)

如果没有看到字符串操作的实际最终产品(例如真实查询),我猜测您的$a是空的:

   ... ) VALUES (,'Andrew', ...
                 ^---$a being blank

答案 1 :(得分:1)

我猜想$ a的内容有问题。可能是NULL?