开发者

Getting mysql syntax error and cant find source

开发者 https://www.devze.com 2022-12-23 21:54 出处:网络
I have function that updates log table. function wslog($userID, $log, $where) { safe_query(\"INSERT INTO \".PREFIX.\"log ( time, userID, log, where ) values( \'\".time().\"\', \'\".$userID.\"\', \'\"

I have function that updates log table.

function wslog($userID, $log, $where) {
    safe_query("INSERT INTO ".PREFIX."log ( time, userID, log, where ) values( '".time()."', '".$userID."', '".$log."', '".$where."' ) ");
}

And I have this php code:

wslog($userID, 'server|'.mysql_insert_id().'', 'servers');

But I keep getting syntax error:

  • Query failed: errorno=1064

  • error=You have an error in your SQL syntax; check th开发者_运维知识库e manual that corresponds to your MySQL server version for the right syntax to use near 'where ) values( '1269208030', '1', 'server|14', 'servers' )' at line 1

  • query=INSERT INTO ws_DII_log ( time, userID, log, where ) values( '1269208030', '1', 'server|14', 'servers' )


Is it possible that SQL doesn't like your log field name as it is a reserved word?

If so, try putting it is backticks

log ( `time`, `userID`, `log`, `where` )
0

精彩评论

暂无评论...
验证码 换一张
取 消