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... 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. 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! Link to comment https://forums.phpfreaks.com/topic/80349-solved-create-table-question/#findComment-408504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.