Jump to content

help with forms and variables


yanks6rule

Recommended Posts

I have conquered the langauge to take the information from one MySQL table and display it with PHP in a web broswer. I am not trying to do take information from two tables and display it.

Maybe someone will be able to point me to a good tutorial to do this, but I am having problems coming up with a good flow to this problem. I have alumni sign in to a web page. On their welcome page they can update their information. I have made it so that the login and logout work fine. I now want to add a way for them to register for an event. The way I had in mind is what follows, not all of this is under my control because I am not allowed to create my own tables since the head IT guy wants control but he doesn't want to do any of the PHP scripting to make any of this work.

I have the following tables 1. Alumni 2. Event 3. Alumni_event 4. guest
When registering I want the first page to be for the person to select an event, then hit submit. The next page will show which event they selected and ask them to insert their first guest. Then the have the option to review and finish or add another guest. If they hit add another guest they guest they just added will appear with a radio button and the option to delete and the form will be blank to add guest 2. I am having a problem trying to display the event after hitting submit because I can't figure out exactly how to store the data from two tables in variables so that I can output it in text.

My SQL query is:
$query = "SELECT alumni_event.eid, event.eid, event.event WHERE alumni_event.eid='$eid' AND event.eid=alumni_event.eid";

and then I just tried a mysql_num_rows() and a while loop using mysql_result() to store the data, but I didn't think it would work because it seems like you won't have one a specific row because you are over multiple columns, but it looked like this:

$result = mysql_query($query);
$num = mysql_num_rows($result);
$i = 0;
while ($i < $num) {
$eventID = mysql_result($result,$i,"eid");
$alumnusID = mysql_result($result,$i,"pid");
$event_name = mysql_result($result,$i,"event");
}

Sorry this is so long but if anyone can point me in the right direction that would be great.

Thanks,
Yanks
Link to comment
Share on other sites

first off, you are probably going to have to look into the sql JOIN keyword.

2nd, seeing as how your IT sounds lazy, if you need another table, there's a good chance the username/pw you have that you use to connect to the database probably has permission to create a table. you can always do a query through php to create what you need....

but that's kinda sneaky and if you're IT guy sees that extra table in there you may or may not get in trouble [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /]
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.