Jump to content

MYSQL create table on the fly with variable in PHP?


dano2000

Recommended Posts

Noob here... Flames, jabs, I know I got it all coming....

I have a php/myspl db. Trying to store a meeting registration db...

I got a table for meeting and table for users.

When the user creates a new meeting they supply seats available($seats) and reserve seats available($resseats) lets say.

So where do I start when I want to create the table on the fly to store seats based off of the $seats and $resseats variables/numbers.

I know, I will have to loop to create the field names for the table on the fly.

Can I loop within a CREATE TABLE statement? Not sure what that would look like.

Or do I need to create and set of field names first, then shove them into the CREATE TABLE?

Sorta brain fried and brain blocked here.

Just kinda need a push in the right direction.

I understand the basics of php and mysql and have php putting and getting info from mysql db.

I admit though this is a little above my head.

Thanks for any info.

Link to comment
Share on other sites

Maybe more explanation:

I already have a table for the meeting. I want to create a table on the fly, when the meeting is entered by user, to have fields to hold the userid's of the participants that want to attend the meeting.

 

Sorry if I am not explaining well.

 

already have meeting tbl (meetingid, meetingname, maxparticipants, maxreserveparticipants, date, location ect...

already have user tbl ( userid, fname, lname, email)

 

what I want is to use the maxparticipants and maxreserveparticipant numbers to create a table that holds the userid's of the people who want to sign up. maxpart and maxres numbers may be different for each meeting based on user input.

 

participant table (meetingid, participant1, participant2 until == maxparticipants)

I want this table/s to be created when the user creates the meeting.

Hope this makes sense.

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.