RE: [PHP] Deleting all rows in a database every 24 hours?

2008-02-25 Thread Daevid Vincent
Or make a 'truncate.sql' file with the tables in it to truncate:

TRUNCATE TABLE foo;
TRUNCATE TABLE bar;

Then in the crontab mysql mydatabase  truncate.sql 

No PHP needed.

 -Original Message-
 From: Daniel Brown [mailto:[EMAIL PROTECTED] 
 Sent: Friday, February 22, 2008 6:59 AM
 To: Zoran Bogdanov
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Deleting all rows in a database every 24 hours?
 
 On Fri, Feb 22, 2008 at 1:28 AM, Zoran Bogdanov 
 [EMAIL PROTECTED] wrote:
  The title says it all, how do I perform an action every 24 hours?
 
 Another question better answered on Google.
 
 PHP Script:
 ?
 $sql = TRUNCATE TABLE `tablename`;
 mysql_query($sql);
 ?
 
 Crontab Entry:
 40 3 * * * `which php` /path/to/your/script.php
 
 That will run every morning at 3:40a server time with the
 path-preferred PHP.  If you're on Windows, look up Scheduled Tasks.
 
 -- 
 /Dan
 
 Daniel P. Brown
 Senior Unix Geek
 ? while(1) { $me = $mind--; sleep(86400); } ?
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Deleting all rows in a database every 24 hours?

2008-02-22 Thread Daniel Brown
On Fri, Feb 22, 2008 at 1:28 AM, Zoran Bogdanov [EMAIL PROTECTED] wrote:
 The title says it all, how do I perform an action every 24 hours?

Another question better answered on Google.

PHP Script:
?
$sql = TRUNCATE TABLE `tablename`;
mysql_query($sql);
?

Crontab Entry:
40 3 * * * `which php` /path/to/your/script.php

That will run every morning at 3:40a server time with the
path-preferred PHP.  If you're on Windows, look up Scheduled Tasks.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Deleting all rows in a database every 24 hours?

2008-02-22 Thread Bastien Koert

cron
 
bastien To: php-general@lists.php.net From: [EMAIL PROTECTED] Date: Fri, 22 
Feb 2008 07:28:58 +0100 Subject: [PHP] Deleting all rows in a database every 
24 hours?  The title says it all, how do I perform an action every 24 hours? 
 Thank you.   --  PHP General Mailing List (http://www.php.net/) To 
unsubscribe, visit: http://www.php.net/unsub.php 
_



[PHP] Deleting all rows in a database every 24 hours?

2008-02-21 Thread Zoran Bogdanov
The title says it all, how do I perform an action every 24 hours?

Thank you. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Deleting all rows in a database every 24 hours?

2008-02-21 Thread Paul Scott

On Fri, 2008-02-22 at 07:28 +0100, Zoran Bogdanov wrote:
 The title says it all, how do I perform an action every 24 hours?
 

$sql = TRUNCATE TABLE 'sometable';
$this-query($sql);

on a cron.daily

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php