$Row['Numbr'] is a varchar and never contains escaped characters. The entry, for instance, of 2457 in the $_POST should match to a database field content of 2457, but that entry does occur and does not reset the $Flag variable to zero, and I simply am missing the reason why it does not.
Code: Select all
<?php
if (isset($_POST['Last'])) // user clicked okay button: put all reports into
{ // a session array to be used for printing sequence
$_SESSION['Rcnt'] = 0; // the count of number to be done
$_SESSION['Doing'] = 0; // the one currently doing
$Flag = strlen($_POST['Last']); // greater than zero if entry made
$Query = "SELECT id FROM Stores ORDER BY Score,Num";
$Oresult = mysql_query($Query, $Link); // get stores by owner, number
while ($Orow = mysql_fetch_array($Oresult)) // owner based on sorting variable in the stores
{
$Query = "SELECT id,Numbr FROM Reports WHERE Sid=" . $Orow['id'];
$Result = mysql_query($Query, $Link);
if ($Row = mysql_fetch_array($Result)) // there will only be one report per store
{ if (!$Flag)
{ $_SESSION['Rcnt']++; // bump the array counter
$_SESSION['Run'][] = $Row['id']; // add report to the array
}
elseif (!strcmp($_POST['Last'],$Row['Numbr'])) $Flag = 0;
}
}
}
?>