Can anyone please tell me what is the code to clear out a MySQL Table? I just need it so that when I run the page it will clear the specified Table in the specified database. Thanks.
I looked for the code here on Pixel2Life.com but I did not find it.
MySQL Clearing
Started by Fernando, Jul 20 2005 06:58 PM
7 replies to this topic
#1
Posted 20 July 2005 - 06:58 PM
#2
Posted 20 July 2005 - 07:01 PM
if u cant find it... try phpMyadmin, im sure you can clear the table in there....
#3
Posted 20 July 2005 - 07:03 PM
I checked but I have to delete each row manually and besides, not that I'm being lazy but if I could just run that code without having to log into PhpMyAdmin it would be a lot easier. This is to clear out all my referrers, and I get over 100 hits per day from referrers so every now and then I want to clear it out.
#4
Posted 20 July 2005 - 07:37 PM
If you want to clear everything from one table, just run "DELETE FROM table_name"
#5
Posted 20 July 2005 - 07:43 PM
Thank You! That's just what I was looking for
.
#6
Posted 21 July 2005 - 12:29 AM
Blitz's code will work just fine, but for future reference:
If you notice, there's more then just one way to delete stuff from phpmyadmin.
You can empty, drop, and truncate tables (not listed). They are the red buttons at the top of the page to the right. Just click the button once, and copy the code it out puts, that simple.
You can also visit the mysql link in the sticky at the top of the page (it give's you every possible command you could want to run in mysql).
If you notice, there's more then just one way to delete stuff from phpmyadmin.
You can empty, drop, and truncate tables (not listed). They are the red buttons at the top of the page to the right. Just click the button once, and copy the code it out puts, that simple.
You can also visit the mysql link in the sticky at the top of the page (it give's you every possible command you could want to run in mysql).
#7
Posted 21 July 2005 - 01:40 AM
TRUNCATE table_name;
Always works for me.
Always works for me.
#8
Posted 23 July 2005 - 04:23 PM
Where you would DELETE everything from a table and still have an empty table left, DROP would leave you with not even the table.
(thatīs an old chinese saying)
(thatīs an old chinese saying)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
