Here is the updated question:
the current query is doing something like:
$sql1 = \"TRUNCATE TABLE fubar\"; $sql2 = \"CREATE TEMP
If you're using PHP, use mysql_list_tables to check that the table exists before TRUNCATE it.