Error with MySQL syntax using REPLACE INTO
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 )
精彩评论