user2216190
user2216190

Reputation: 834

TRUNCATE does not work

Does anybody know why this SQL query doesn't clear my table (table name in the variable $datetoday) the queries after it does work, whats wrong? right now $datetoday = 300313

mysql_query('TRUNCATE TABLE `data`.`".$datetoday."`');

EDIT : the error is :

Could not clear table: Table 'data.".$datetoday."' doesn't exist

Upvotes: 0

Views: 482

Answers (1)

Michael
Michael

Reputation: 12802

Change to:

mysql_query('TRUNCATE TABLE `data`.`' . $datetoday . '`');

You're enclosing the query in ' but then using " around $datetoday.

Upvotes: 2

Related Questions