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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.