Riddle me this... in the while($row = mysql_fetch_assoc($result) and $runningOK)
loop, if the PHP &&
operator is used in place of the and
the mysql_fetch_assoc fails terrible and returns just the number 1
when running. I've tried mysql_fetch_array()
and in place and I still have the 1 problem. It is when, and only when, I replace the &&
with a and
like the current while statement is that the correct rows are returned.
I had placd debug statements before, inside, and after to insure this. I would like to know if this is a PHP quirk or something I couldn't account for.
// Query
$selectQuery = "SELECT * FROM jobs_cache LIMIT 20";
// Run the Selection Query.
$result = mysql_query($selectQuery)
or die('Query Failed: '.mysql_error());
// Loop through results.
$runningOK = TRUE;
$resubmitList = array();
while($row = mysql_fetch_assoc($result) and $runningOK)
{
// Resubmit The Job
try
{
$client->addTaskBackground($row['function_name'],$row['job_data']);
$resubmitList[] = (string)$row['job_cache_id'];
}
catch(Exception $e)
{
echo "Error adding task for job id: " . $row['job_cache_id'];
$runningOK = FALSE;
}
}