When I run the following code, and sendMatches is set to yes in the database, the “Stopped: All Notifications” message correctly displays. However, if I reload the webpage when sendMatches is set to no in the database, the “Oooops” message does not display. Any ideas on what I’m overlooking?
Thanks!
// Does sendMatches already = “No”?
$alreadyLogged = “SELECT lastLogin FROM users WHERE uID = ‘$_SESSION[uID]’ and sendMatches = ‘No’”;
$pageHeader = “Oooops”;
$pageIntro = “<p>You have already indicated that you are no longer interested in maintaining a membership on our website. We made note of your decision in your account.</p>”;
} else {
// Display text to member
$pageHeader = “Stopped: All Notifications”;
$pageIntro = “<p>Thank you for letting us know. You will no longer receive search match notifications for ANY of your saved searches. If this was done by mistake, you can turn the notifications back on by going into <a href = ‘myInfo.php’>My personal info</a>.</p>”;
I cannot test this as I do not use mysql_* functions, but I think it returns false if nothing matching is found. fetch_row at least only tries to get 1 row …
if (mysql_fetch_array($result)) {
//something was found
}else{
//nothing was found
}
You should seriously be moving away from the mysql_* extension and over to either the mysli_* (MySQL Improved) extension or PDO. The mysql_* extension is deprecated as of the current version of php and will highly likely be removed from the next version of PHP