开发者

Error with MySQL syntax using REPLACE INTO

开发者 https://www.devze.com 2022-12-09 14:37 出处:网络
I am getting syntax error with the following statement REPLACE INTO users (screenname, token, secret) VALUES( \'开发者_StackOverflow社区$screenname\', \'$token\', \'$secret\' ) WHERE \'screenname\' =

I am getting syntax error with the following statement

REPLACE INTO users (screenname, token, secret) VALUES( '开发者_StackOverflow社区$screenname', '$token', '$secret' ) WHERE 'screenname' = $screenname

The table has a primary key named id, which auto-increments.


From what i know, REPLACE has no WHERE, you probably want UPDATE instead


You need to have a UNIQUE index on screenname.

Also your quotes are wrong in the WHERE clause:

WHERE screenname = '$screenname'

I'm going to assume all your variables have been put through mysql_real_escape_string() :)


try removing both single quotes in the variables of the

values VALUES( '$screenname', '$token', '$secret' )

Eg:

values VALUES($screenname, $token, $secret )

0

精彩评论

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