Jacbey Posted December 10, 2011 Share Posted December 10, 2011 Hi guys, i cannot figure out what is wrong with this and I hope you could help figure it out? This is the code I am using - $create_cart_table = "CREATE TABLE `". $string ."` (cart_id int NOT NULL AUTO_INCREMENT, PRIMARY KEY(cart_id), item_name VARCHAR(1000) NOT NULL, item_id VARCHAR(30) NOT NULL, price VARCHAR(30) NOT NULL, date_time TIMESTAMP(100) NOT NULL CURRENT_TIMESTAMP, quantity VARCHAR(100) NOT NULL)"; $set_cart_table = mysql_query($create_cart_table); $string is defined above and there are no database connection warnings etc coming up and I am lost as to how the heck this isn't working? It was working for about an hour when I first made the script but now it is not. Please help? Quote Link to comment https://forums.phpfreaks.com/topic/252899-creating-a-table-in-php-problem/ Share on other sites More sharing options...
xyph Posted December 10, 2011 Share Posted December 10, 2011 Echo out mysql_error(). It's probably a duplicate table error Generally, you shouldn't be creating tables on the fly. You should have a single table, with an extra column unique to each 'set' of information. Quote Link to comment https://forums.phpfreaks.com/topic/252899-creating-a-table-in-php-problem/#findComment-1296617 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.