MySQL Syntax error. Can't solve it

前端 未结 5 2065
南方客
南方客 2021-01-26 01:22

I wanna insert 0 to some db table\'s fields but can\'t get it work. The piece of code from my signup php script looks like that.

...

if (isset($type))
{         


        
5条回答
  •  盖世英雄少女心
    2021-01-26 01:38

    4 things,

    1. escape your values: mysql_real_escape_string
    2. properly add php vars to a string: sprintf or for array notation use curly braces "{$data['var']}"
    3. backtick around group (or every field name to be certain)
    4. Don't enclose NULL or NOW() in ticks, quotes etc.. (you are actually OK on this, just wanted to make sure you kept it)

提交回复
热议问题