xclusivzik Posted November 25, 2014 Share Posted November 25, 2014 i want a situation where, when i upload something into my database, it creates a new table, everytime, i saw this $forum = "CREATE TABLE IF NOT EXISTS for_".$id." ( `id` int(11) NOT NULL AUTO_INCREMENT, `stud` int(11) DEFAULT NULL, `course` int(11) DEFAULT NULL, `message` varchar(1000) DEFAULT NULL, PRIMARY KEY (`id`) ) "; but don't know how to implement it into this query $sql = "INSERT into data(name,Groups,phone_number) values('$data[0]','$data[1]','$data[2]')"; Quote Link to comment https://forums.phpfreaks.com/topic/292701-how-to-insert-into-a-new-table-everytime-the-query-is-implemented/ Share on other sites More sharing options...
ginerjm Posted November 25, 2014 Share Posted November 25, 2014 Something about your solution is flawed. Why would you design a database structure that makes you create a whole new table for a set of data? You defeat the whole purpose of having a well-organized database that facilitates the storage and ready retrieval of your data. Assuming that the sets of data each time refer to the same entities then putting those sets of data into separate tables is ridiculous. How would you ever write a query to find a specifici set of data(aka, row)? I urge you to re-think your db design here. Quote Link to comment https://forums.phpfreaks.com/topic/292701-how-to-insert-into-a-new-table-everytime-the-query-is-implemented/#findComment-1497616 Share on other sites More sharing options...
xclusivzik Posted November 25, 2014 Author Share Posted November 25, 2014 it for confirmation purposes, when it is uploaded, so that each uploads can be differentiated Quote Link to comment https://forums.phpfreaks.com/topic/292701-how-to-insert-into-a-new-table-everytime-the-query-is-implemented/#findComment-1497621 Share on other sites More sharing options...
ginerjm Posted November 25, 2014 Share Posted November 25, 2014 Differentiated? Whatever do you mean? Like a key? Add one! Do not create multiple tables to separate your records. That's like building a library to store one book. Quote Link to comment https://forums.phpfreaks.com/topic/292701-how-to-insert-into-a-new-table-everytime-the-query-is-implemented/#findComment-1497623 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.