At my wit's end on this one...
Every time I run this (with the querystring blank or set to some invalid text), the numrecs echo shows a value of 1 (and the code branches in that direction.) But in reality, there are ZERO records found.
If I copy the echoed query from the screen and paste it into phpMyAdmin, it returns "0". Can anyone spot the problem?
PHP Code:
$qs=$_SERVER['QUERY_STRING'];
$query = " SELECT COUNT(*) FROM main WHERE UserCode = '" . $qs . "' ";
echo 'querystring = "' . $qs . '"<br>query = "' . $query . '"<br>';
$result = mysql_query($query,$dblink) or die(mysql_error());
$numrecs = mysql_numrows($result);
echo 'numrecs = ' . $numrecs;
if($numrecs < 1) {
// INVALID USER
echo 'Recs = 0';
Header( "Location: ./login.php" );
} else {
// VALID USER
?>
<html>
<head>
. . .
Bookmarks