IF statement causing 500 Internal Server Error
The IF statement below causes a 500 error. The page loads fine when I 开发者_JS百科remove the IF statement.
If there anything wrong with it?
$oldtweets = mysql_query("SELECT submissionid, loginid FROM tweets WHERE submissionid = '$submissionid' AND loginid = '$loginid'");
if (mysql_num_rows($oldtweets) = 0)
{
mysql_query("INSERT INTO tweets VALUES (NULL, '$city', '$submissionid', '$fullurl', '$uid', '$username', NULL)");
}
You are using a single =
, which is the assignment operator. You should be using ==
, the comparison operator.
First thing I would look at is this -
if (mysql_num_rows($oldtweets) = 0)
Should be this -
if (mysql_num_rows($oldtweets) == 0)
精彩评论