monkeytooth Posted November 16, 2009 Share Posted November 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/181698-truncating-a-mysql-table-with-php/ Share on other sites More sharing options...
Zyx Posted November 16, 2009 Share Posted November 16, 2009 Single quotes are used to enclose strings (data types), not table names. phpMyAdmin and the rest use backticks. Quote Link to comment https://forums.phpfreaks.com/topic/181698-truncating-a-mysql-table-with-php/#findComment-958306 Share on other sites More sharing options...
monkeytooth Posted November 16, 2009 Author Share Posted November 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/181698-truncating-a-mysql-table-with-php/#findComment-958414 Share on other sites More sharing options...
Mchl Posted November 16, 2009 Share Posted November 16, 2009 Change ' to ` or just drop quotes at all. Quote Link to comment https://forums.phpfreaks.com/topic/181698-truncating-a-mysql-table-with-php/#findComment-958422 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.