Re: clear a mysql table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 25, 2008 at 11:02 AM, Ronald Wiplinger (Lists)
<ronald_lists@xxxxxxxxx> 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@xxxxxxxxxxxx || danbrown@xxxxxxx

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux