Reputation: 834
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
Reputation: 12802
Change to:
mysql_query('TRUNCATE TABLE `data`.`' . $datetoday . '`');
You're enclosing the query in '
but then using "
around $datetoday
.
Upvotes: 2