Jump to content


help with forms and variables

  • Please log in to reply
1 reply to this topic

#1 yanks6rule

  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 09 May 2006 - 09:43 PM

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.


#2 .josh

  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 09 May 2006 - 09:49 PM

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\" /]
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users