I'm currently trying to update over a thousand records at a time in mySQL, however my code seems to be timing out.
I was wondering if anyone can suggest a better/ more efficient way.
At the moment I am iterating through a loop like so:
$sql = "SELECT * FROM pricing WHERE price_id BETWEEN 1000 AND 2000";
$okrows = array();
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_assoc($result)){
$rows[] = $row;
}
foreach($rows as $row){
$date1 = DateCalculation($row[week]); //
$sql = "UPDATE pricing SET week = '$date1' WHERE week = '$row[week]' AND price_id = $row[price_id]";
echo $sql;
echo "<p>";
$result = mysql_query($sql) or die(mysql_error());
}