Hi
All, I have a table with a weeks worth of time slots saved which include day, time and availability. This table is used
as a template for the main calendar system so you can load a weeks saved time slots into your calendar for any particular week of the year.
The table holds approx 28,000 records for a given week depending on the number of hours and days they work.
Codes taking ages to load, tried putting data into an array and pulling out but still slow.
Any ideas on how to speed this up ?
if($loadSlots==“YES”)
{
$loadStartTimeStamp = strtotime( “$day-$month-$year”);
$loadFinishTime = $loadStartTimeStamp + 6048000;
$query = "SELECT staffID, timeSlotID, timeInterval FROM tblServicesTimeSlotDetails WHERE clientID='".$_SESSION['clientID']."'";
$result = mysql_query($query,$db);
$row = mysql_fetch_array($result);
$interval = $row[timeInterval];
$staffID = $row[staffID];
$timeSlotID = $row[timeSlotID];
for($i=$loadStartTimeStamp; $i<=$loadFinishTime; $i+=60)
{
$day = gmdate("D", $i);
$time = gmdate("G:i", $i);
$query2 = "SELECT status FROM tblServicesSavedTimeSlots WHERE clientID='".$_SESSION['clientID']."' AND staffID='$staffID' AND
day='$day' AND time='$time'";
$result2 = mysql_query($query2,$db);
$row2 = mysql_fetch_array($result2);
$status = $row2[status];
$query3 = "INSERT INTO tblServicesTimeSlots SET timeSlotID='$timeSlotID', clientID='".$_SESSION['clientID']."', staffID='$staffID',
slotTime='$i', slotStatus='$status', LIVE='NO'";
mysql_query($query3,$db);
}
}