Jump to content

how to insert into a new table everytime the query is implemented


xclusivzik

Recommended Posts

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]')";
 
            

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.