I am working with php 5.4.7, and mysql 5.0. I have a loop in php which runs a SQL Select statement. So in the loop it runs the Select, then in another statement some records are updated, when the loop starts over it needs to run the Select statement again in case some records were changed however the result set of the Select statement is the same in every iteration of the loop regardless of whether the records it's selecting has changed.
I've tried flushing table and an array of other methods to try and clear, what I can only imagine is, a cache that is not getting cleared.
This is for a zen cart site hence the "TABLE_NAME" format.
$num_elements = 5;
$first_letter = 'a';
for($i = 0; $i < $num_elements; $i++){
$sql_letter = "SELECT * FROM " . TABLE_CATEGORIES_DESCRIPTION . " WHERE categories_name LIKE :first_letter:";
$sql_letter = $db->bindVars($sql_letter, ':first_letter:', $first_letter, 'string');
$categories_description_letter_data = $db->Execute($sql_letter);
if($something_happens){
$sql = "UPDATE " . TABLE_CATEGORIES_DESCRIPTION . " SET status = 1 WHERE id = '$id'";
$result = $db->Execute($sql);
}
}