Welcome to WebmasterWorld Guest from 50.19.190.144

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Emptying A Table

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

Preferred Member

10+ Year Member

joined:Mar 4, 2004
posts:553
votes: 0


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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 24, 2005
posts:697
votes: 0


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

New User

5+ Year Member

joined:Feb 11, 2006
posts:17
votes: 0


<?php

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

mysql_select_db('db_name);

$sql = "TRUNCATE TABLE `table_name`";

mysql_query($sql);

mysql_close($connection);

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

Administrator

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

joined:July 24, 2001
posts:15755
votes: 0


or just

delete from tablename

that deletes all rows

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members