Jump to content

truncating a mysql table with php


monkeytooth

Recommended Posts

I don't know what the issue is with this. mysql_error() reports a version issue due to syntax. But phpMyAdmin from my understanding is using the same command. And is working for that matter.

 

$sql = mysql_query("TRUNCATE TABLE 'log_access'") or die(mysql_error());

 

But I am growing tired of having to go through the tables everytime one by one and empting the ones i need to for the purpose of testing what I am building.

Link to comment
https://forums.phpfreaks.com/topic/181698-truncating-a-mysql-table-with-php/
Share on other sites

I understand that, so taking that into mind i turn the table name as show in my previous errored version, into a var, and use the var to define the table name, but still get the same error.. i dunno what to do, ive got to reset these tables to "New" every few times i do what im doing til i get it done right, and then one last time when its finally done as a form of mater reset. Its just a pain in the arse is all cause currently I have 5 tables that I need to do this with but in the end its going to be about 53 tables, and in phpmyadmin you all know thats an annoying task if youve ever done it once to one table.

 

Select Table, Click empty, Wait, go onto next, repeat.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.