Fastest way to illustrate my point is to create a file on a clean 1.53 install containing the below code and then run it:
Code:
<?php
require('includes/application_top.php');
$i = 0;
$times = 100;
while ($i++ < $times){
// Select ALL records from the manufacturers table
$all_manufacturers_sql = $db->Execute("SELECT * FROM " . TABLE_MANUFACTURERS . " WHERE 1");
echo 'Iteration ' . $i . '. The manufacturers table currently contains:<br />';
echo '-------------------------<br />';
echo '| ID | Name |<br />';
while(!$all_manufacturers_sql->EOF){
// Echo each record
echo '| ' . $all_manufacturers_sql->fields['manufacturers_id'] . ' | ' . $all_manufacturers_sql->fields['manufacturers_name'] . ' |<br />';
echo '-------------------------<br />';
$all_manufacturers_sql->MoveNext();
}
echo '<br />';
// Insert Manufacturer X into the manufacturers table
$sql_data_array = array(
'manufacturers_name' => 'Manufacturer ' . $i,
'date_added' => 'now()'
);
zen_db_perform(TABLE_MANUFACTURERS, $sql_data_array);
echo 'I\'ve just inserted "Manufacturer ' . $i . '", which is manufacturers_id ' . $db->Insert_ID() . '.<br />';
echo '<br /><hr />';
}
require('includes/application_bottom.php');
?>
The on-screen output will show you that each time the manufacturers table is queried, it always returns 0 records, even though the previous iteration has just inserted a manufacturer into the table (and you can see the Insert_ID in the previous iteration).
Run the same code on ZC 1.50 and you will see that each time the table is queried it returns all of the manufacturer records in the table, the number of which increases by 1 after each iteration.
Bookmarks