Welcome to WebmasterWorld Guest from 54.205.96.97

Forum Moderators: coopster & jatar k

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



<?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)

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

My Threads

Hot Threads This Week

Hot Threads This Month