DaVuLf Posted May 28, 2006 Share Posted May 28, 2006 I was wondering if there is php code that can drop tables or clear all records from them. I'm doing alot of testing, and I need pretty blank or non-existent tables when I start this for real. As such, I need to continually go through phpMyAdmin in order to clear records, and delete tables.Is there a way to set up a query to DROP table1, table2, table3, table3 or SELECT * FROM table4 DELETE. Anything similar to those would be great. Thanks,DaVuLF :) Quote Link to comment https://forums.phpfreaks.com/topic/10662-drop-clear-tablesfields/ Share on other sites More sharing options...
fenway Posted May 28, 2006 Share Posted May 28, 2006 You can always call a TRUNCATE TABLE statement if you want to empty the table out -- it's faster than DELETE anyway. Same goes for DROP. But I don't know what you mean by PHP code -- it's just a MySQL statement that you need to issue via the DB layer. Quote Link to comment https://forums.phpfreaks.com/topic/10662-drop-clear-tablesfields/#findComment-39794 Share on other sites More sharing options...
DaVuLf Posted May 28, 2006 Author Share Posted May 28, 2006 [!--quoteo(post=377919:date=May 28 2006, 05:07 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ May 28 2006, 05:07 PM) [snapback]377919[/snapback][/div][div class=\'quotemain\'][!--quotec--]You can always call a TRUNCATE TABLE statement if you want to empty the table out -- it's faster than DELETE anyway. Same goes for DROP. But I don't know what you mean by PHP code -- it's just a MySQL statement that you need to issue via the DB layer.[/quote]Well, I'm using php right. So say I have a file called 'Clear.php' with a submit button on it, I'd like that post action to truncate and drop some tables. Quote Link to comment https://forums.phpfreaks.com/topic/10662-drop-clear-tablesfields/#findComment-39796 Share on other sites More sharing options...
fenway Posted May 29, 2006 Share Posted May 29, 2006 OK -- still, it's just issuing commands; you can write whatever wrapper you desire. Quote Link to comment https://forums.phpfreaks.com/topic/10662-drop-clear-tablesfields/#findComment-39827 Share on other sites More sharing options...
DaVuLf Posted May 29, 2006 Author Share Posted May 29, 2006 [!--quoteo(post=377954:date=May 28 2006, 09:05 PM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ May 28 2006, 09:05 PM) [snapback]377954[/snapback][/div][div class=\'quotemain\'][!--quotec--]OK -- still, it's just issuing commands; you can write whatever wrapper you desire.[/quote]I don't mean to sound beliggerent, but I just started using PHP the day I registered with this forum. I tried searching for the syntax to do that, but I have no idea. Thanks anyways :). Quote Link to comment https://forums.phpfreaks.com/topic/10662-drop-clear-tablesfields/#findComment-39829 Share on other sites More sharing options...
fenway Posted May 29, 2006 Share Posted May 29, 2006 PHP has a whole set of functions for interfacing with MySQL -- mysql_query() to run queries, mysql_fetch_assoc() to retrieve result sets, etc. There are many resources -- both on this forum, the web, and in the PHP documentation -- that cover this is more detail. I'm not really that good at PHP at all, so I'm not the right guy to ask. Quote Link to comment https://forums.phpfreaks.com/topic/10662-drop-clear-tablesfields/#findComment-39876 Share on other sites More sharing options...
DaVuLf Posted May 29, 2006 Author Share Posted May 29, 2006 Oh, okay, no problem man. Thanks for the help :). Quote Link to comment https://forums.phpfreaks.com/topic/10662-drop-clear-tablesfields/#findComment-39926 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.