sser Posted December 5, 2007 Share Posted December 5, 2007 Hi everybody, How can I create a table where the name is a variable specified before? The code snippet is..: $test_table = basename($array[$i], ".dat"); #mysql_query($test_table); echo $test_table; $query = "CREATE TABLE '$test_table' (field1 INT, field2 CHAR(20) NOT NULL, field3 CHAR(50) NOT NULL)"; where $test_table is supposed to be the filename. When I try running this code, the table is named as $test_table. Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/80349-solved-create-table-question/ Share on other sites More sharing options...
fenway Posted December 5, 2007 Share Posted December 5, 2007 You want backticks, not quotes. Quote Link to comment https://forums.phpfreaks.com/topic/80349-solved-create-table-question/#findComment-407264 Share on other sites More sharing options...
sser Posted December 7, 2007 Author Share Posted December 7, 2007 Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/80349-solved-create-table-question/#findComment-408504 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.