I need to lock a table and delete some old data from it.
Can I lock it with WRITE and delete some data inside while it's locked ?.
Here is my code:
$TodaysDate=date("Ymd");
$today = getdate();
$Year = $today[year];
$mon = $today[mon];
$mday = $today[mday];
$yesterday=$mday - 1;
$DelDate=$Year.$mon.$yesterday;
mysql_query("LOCK TABLES Appoints WRITE");
mysql_query("delete from Appoints where Date<='$DelDate'");
mysql_query("UNLOCK TABLES");
Thanks,
Peter
Can I lock it with WRITE and delete some data inside while it's locked ?.
Here is my code:
$TodaysDate=date("Ymd");
$today = getdate();
$Year = $today[year];
$mon = $today[mon];
$mday = $today[mday];
$yesterday=$mday - 1;
$DelDate=$Year.$mon.$yesterday;
mysql_query("LOCK TABLES Appoints WRITE");
mysql_query("delete from Appoints where Date<='$DelDate'");
mysql_query("UNLOCK TABLES");
Thanks,
Peter