我使用的脚本是
if($profile['username'] == $user['username']) {
$db->query("UPDATE users SET newcomments = 0 WHERE username = '$user[username]'");
echo "This is a test";
}(请注意,$db->查询与mysql_query完全相同)
由于一些非常奇怪的原因,即使定义的条件为false,也会执行MySQL查询
"This is a test“可以正常工作,并且只有在满足条件时才会出现,但无论如何都会执行MySQL查询
它有什么问题?
发布于 2010-03-15 23:52:00
通常情况下,这类问题的答案在其他地方。也许类似的SQL代码会在其他地方调用?
发布于 2010-03-16 00:04:32
您的代码看起来很好。尝试:
echo "<pre>";
print_r($profile);
print_r($user);看看这是不是你所期望的。
发布于 2010-03-16 00:37:40
我很难相信这一点,不管怎样,试着这样做。
$query="";
if($profile['username'] == $user['username']) {
$query ="UPDATE users SET newcomments = 0 WHERE username = '" . $user[username] . "' ";
echo "This is a test";
}
echo $query;
$db->query($query);https://stackoverflow.com/questions/2448442
复制相似问题