我的sql语句有问题。我不知道我在做什么错,但它不断添加到数据库中多,而不是上传我的PHP SQL语句有什么问题?
$result = mysql_query("SELECT id FROM users where fbID=$userID");
if (mysql_num_rows($result) > 0) {
mysql_query("UPDATE users
SET firstName='$firstName'
, lastName='$lastName'
, facebookURL='$link'
, birthday='$birthday'
, update='$today'
, accessToken='$accessToken'
, parentEmailOne='$parentEmailOne'
, WHERE fbID='$userID'");
} else {
mysql_query("INSERT INTO users
(fbID, firstName, lastName, facebookURL, birthday
, updated, accessToken, parentEmailOne)
VALUES ('$userId', '$firstName', '$lastName', '$link', '$birthday'
, '$today', '$accessToken', '$parentEmailOne')");
}
什么FBID列的类型? – 2011-05-04 20:53:23
你的意思是插入而不是更新? *上传*不清楚 – 2011-05-04 20:53:23
暂时将第一行更改为mysql_query(“SELECT id FROM users where fbID = $ userID”)或die(mysql_error());'以查看是否正在返回错误。 – webbiedave 2011-05-04 20:56:23