Code: Select all
SELECT id,Sid FROM Reports WHERE Stat>1 AND Stat<4 ORDER BY NumbrWhen executed by this following code, it returns zero records.
Code: Select all
$Query = "SELECT id,Sid FROM Reports WHERE Stat>1"; // all reviewed reports
if ($_SESSION['Method'] > 2)
$Query .= " AND YEAR(Date)=" . $_SESSION['Cyr'] . " AND MONTH(Date)=" . $_SESSION['Cmth'];
else if ($_SESSION['Method'] > 1)
$Query .= " AND Sid=" . $_SESSION['Cstr']; // for selected store
else $Query .= " AND Stat<4"; // not previously viewed
$Query .= " ORDER BY Numbr";
$Result = mysql_query($Query, $Link);
while ($row = mysql_fetch_array($Result))
// etcThe other two constructs result in similar query strings and they return results just fine
from the same table, so database is selected properly and all that.
Any help from any of you gurus?