views:

33

answers:

1

I'm trying to create a drop down select option using PHP, MySQL, and ajadx I have the PHP and ajax pretty much figured out but I'm stumped on how I should organize my tables I couldn't decide so I created it both ways:

The first way the tables are:

  • CourseTbl containing (CourseID*, and CourseName)
  • DateTbl, (DateID*, and DatesOffered(entered as a varchar unsure of how to do date to show two day span)
  • LocationTbl (LocationID*, LocationName)

I figured I could try and connect the ID's for each but realized there is no way to connect them since their are some that repeat dates and some that are offered the same daye.

I also have the a table which just lists all of these together.

TableSelect (ID*, CourseName, DatesOffered, LocationName*)

If I wanted to make it as a drop down select would I have to create a subID that would be and INNER Join? Use an XML with PHP? I just keep asking myself how can I input the information and query it properly?

How is the best way to attack this? any help would be great and thanks for your time!

A: 

It probably would be beneficial for you to store all this data in a single table. The reason I say this is your queries would be a lot less intense (you are not joining on multiple tables) only doing a select from one table then and if you structure your data right you can use the output exactly as is to populate your dropdown boxes.

An interesting methodology to follow is the one where you try to think of what you want to accomplish first and how the end result is going to look and work. Then you design your DB to accommodate you with this structure.

I have found that if your DB structure is right and you serve your php script the data as it needs it, your site is amazingly scalable. I mean it makes sense to use a single select rather than a inner join on 3 tables right?

You would also sit with one set of ID's and no foreign keys etc to keep data integrity. If I read your explanation right then I see the data relates exactly to each other and its always good to group the same data together.

etbal
Awesome Thanks I think that's the way I"m going to approach it. Do You know if for the dates being actually text it will be a problem with exporting and using with Paypal?
awesomeUser475853
Store the dates as Unix timestamps to avoid date field troubles. You can always format a Unix time stamp anyway you want and it's faster as well because its integer.
etbal
sounds good i'll try it out
awesomeUser475853
Does anyone Know How I would be able to take the data from the drop downs and send them over to paypal for payment
awesomeUser475853
It's sent as a POST request when you submit the form.
etbal
is that for the standard paypal or the advanced payments?
awesomeUser475853
dunno awesomeUser475853, Maybe ask another question on that topic, I'm a PHP developer with no paypal experience ;)
etbal