Re: clear a mysql table

From: Date: Sat, 25 Oct 2008 15:24:45 +0000
Subject: Re: clear a mysql table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-282425@lists.php.net to get a copy of this message
On Sat, Oct 25, 2008 at 11:02 AM, Ronald Wiplinger (Lists) <ronald_lists@elmit.com> wrote: > > I plan therefore a web page, which is triggered by cron every hour and > will just clear the table. > > Can I use just: > mysql_query("DELETE FROM cash") > or die(mysql_error()); Please remember that GOOGLE is your friend, so STFW before asking here. Also, note that there's a specific list for database issues, PHP-DB --- http://php.net/mailinglists In direct response to your question, you're looking for the TRUNCATE command. <?php $sql = "TRUNCATE TABLE cash"; mysql_query($sql) or die(mysql_error()); ?> -- </Daniel P. Brown> http://www.parasane.net/ [New Look] daniel.brown@parasane.net || danbrown@php.net

« previous php.general (#282425) next »