MySQL query being performed when PHP if condition not met?
Posted
by Ryan
on Stack Overflow
See other posts from Stack Overflow
or by Ryan
Published on 2010-03-15T15:49:08Z
Indexed on
2010/03/15
15:59 UTC
Read the original article
Hit count: 282
The script I'm using is
if($profile['username'] == $user['username']) {
$db->query("UPDATE users SET newcomments = 0 WHERE username = '$user[username]'");
echo "This is a test";
}
(Note that $db->query is exactly the same as mysql_query)
For some very odd reason, the MySQL query is being performed even if the defined condition is false
The "This is a test" works properly and only appears when the condition is met, but the MySQL query is performed anyway
Whats the problem with it?
© Stack Overflow or respective owner