homepage Welcome to WebmasterWorld Guest from 54.226.93.128
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Emptying A Table
dkin




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

How do you empty a table in mysql using php?

 

Anyango




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

mysql_query("truncate table TABLENAME");

newb




msg:1253470
 10:48 pm on Feb 12, 2006 (gmt 0)

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




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

or just

delete from tablename

that deletes all rows

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved