Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Emptying A Table

4:35 pm on Feb 12, 2006 (gmt 0)

10+ Year Member

How do you empty a table in mysql using php?
5:05 pm on Feb 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

mysql_query("truncate table TABLENAME");
10:48 pm on Feb 12, 2006 (gmt 0)

5+ Year Member


$connection = mysql_connect('localhost', 'user', 'pass');


$sql = "TRUNCATE TABLE `table_name`";



6:13 pm on Feb 13, 2006 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

or just

delete from tablename

that deletes all rows


Featured Threads

Hot Threads This Week

Hot Threads This Month