MYSQL/PHP: Displaying equipment associated with reservation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
schpanky
Forum Newbie
Posts: 3
Joined: Mon Mar 07, 2011 12:32 pm

MYSQL/PHP: Displaying equipment associated with reservation

Post by schpanky »

So, I have two tables in SQL, one is "reservations" that contains, name, reservation id, etc etc the second table is equipment with the following fields:


id equipmenttype equipmentid isitout reservationid

essentially, the functionality I'd like help figuring out is how to display the full reservation information, so that when reservationid matches an ID field in reservations that is will show up as such (when two rows of equipment are set to reservationid = 3):

ReservationID: 3
Name: Anne Styles
Microphone TA23567 1
Turntable SN24354326 1

Where microphone/turntable are the "equipmenttype"s, TA234567/SN24354326 are the equipmentid's and the trailing 1's are to indicate "isitout" is set to 1 (or OUT)

I haven't been able to figure out an algorhithm or mysql query to display the information like above, it's been hurting my little head :(
Post Reply