Jump to content

MySQL question


thecommonthread

Recommended Posts

So I'm pretty new to MySQL.  I have a table named "events" and two fields, one specifying the event name (event_name) and one specifying if the pricing is based on a national or local price list (local_or_national).  So here is an example table I have right now:

 

 

 

   

Event name

   

Pricing

 

 

My Spectacular Eventlocal  A Really Great Eventnational  Cool New Showlocal  Show 7national  Show 8national  My Eventlocal  My Cool Eventnational  Event #2local  Event #3local  Event #4local

 

 

Now in a form, I have a dropdown menu box that displays the event names and a button that submits the form.  Now when I go to the next page, obviously I have the event title stored in a variable, so how do I use that to ask if that event is local or national?

 

Any help would be SOOO much appreciated.  Thanks,

 

thecommonthread

Link to comment
Share on other sites

So it's more PHP question than MySQL, isn't it? ;P

 

$eventName = mysql_real_escape_string($_POST['eventName'])
$sql="SELECT `local_or_national` FROM `events` WHERE `event_name`='$eventName'";
$result=mysql_query($sql);
$row = mysql_fetch_assoc($result);
echo $row['local_or_national'];

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.