Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
I need to update a number of order totals within a DB and have been given this code to look at:
quote:
<?php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
$sql = "SELECT id FROM purchaseorder WHERE datecreated > DATE_SUB(CURDATE(), INTERVAL 2 YEAR)";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo "Update Purchase Order: " . $row["id"] . "<br/>";
updatePurchaseOrderTotals($row["id"]);
}
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
echo 'Update Time : '.$total_time.' seconds.';
?>
Now im not a PHP/Coding person, but the above doesn't appear to be updating anything, from what I can see its searching for orders with a created date of a 2 year period and simply echo'ing them on the page.
Is that correct or have I mis-understood the code?
[Edited on 27-04-2015 by Bart]
|