-
clear mysql database
i would like to clear a mysql database through php. i have a database and would like to clear it but i cant just delete it and then create a new one (cause it takes about 1 day or so for it to process) so is there a way that i can just have it clear all tables and everything from inside the database? thanks
-
Hmm...
I have never worked with php, but I am familiar with sql. Use this SQL query when you want to clear the table but not delete it:
Delete * from tblName1
That should clear out your table for reuse. Now, if you want to delete certain records based on a condition, you add this next line of code to the one above:
where field1 = ('string' or number or whatever)
I hope this is what you are looking for. Good Luck and let me know if this works for you.
Now that I reread your question, I have another idea. You do not want to delete the database, right? Well, another way is to drop the table all together(if you need to) and then recreate it. Here is how you drop a table(I am not sure if mysql supports this, but try it):
DROP Table Table_Name
But I doubt you want to do this. The above stuff about deleting is a better idea, but just thought you might need this.
-
or you can get a gui, sort of, from www.phpwizard.net and download a program called phpMyAdmin. it works miracales, well almost :)
-
k
thank you both........
:) :D :p ;) :cool: