Welcome to WebmasterWorld Guest from 54.226.147.190

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Emptying A Table

     

dkin

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

10+ Year Member



How do you empty a table in mysql using php?

Anyango

5:05 pm on Feb 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mysql_query("truncate table TABLENAME");

newb

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

jatar_k

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