I am confronted to a problem that is driving me crazy. I really do not get it. Here below a very simple table creation. I would like to use a variable to name the table. And it is not working!!!!! If I replace the variable by a “handwriten” name, it works… What the…. Thank you in advance for your replies. Cheers. Marc. In case I did not mentionne it, it is driving me crazy.
$processid = mysql_thread_id();
mysql_select_db("mydb", $con);
$sql = 'CREATE TABLE '.$processid.'
(
bat_file varchar(255),
bat_file_date datetime,
bat_file_misc varchar(255),
bat_titre varchar(255),
bat_lien varchar(255)
)';
mysql_query($sql,$con);
The return value of
mysql_thread_idis not a valid name for a table unless you quote it:Since the quote character is the backtick, it should work if you change it to
I don’t know why you want to create a table named after a
mysql_thread_id(it sounds really fishy), but even if there is a perfectly good reason it might be a good idea to add a prefix in front so that you don’t have to quote it each time.