Here is my db setup
building [ id, name] ex. [1, HR]
room [ id , name, bid] ex. [1, 226, 1]
software [ id, title] ex. [1, MS OFFICE]
softroom[ sid, rid, copies] ex. [1, 1, 56] <--- when a software title is added to a room in my web app it gets added tothe softroom table
Ok so I have the page where it displays all the software titles in the db. I want to be able to click a link with the software that will display all the rooms it is in.
So far I have:
$query = "SELECT * FROM softroom sr INNER JOIN room r ON (sr.rid = r.id) WHERE sid = $sid";
$sid is the software ID from the software title list, I use GET to pass the variable to the next step which is what I am working on, trying to tell what rooms the software is in.
$sid = $_GET['sid'];
Each title on the software list page has a link next to it:
<a href=\"".$self."&sid=$id&title=$title\">"."SELECT</a>
Now with all this said: I have gotten it to tell what rooms the software is in but I ened to have the building right next to each room # otherwise I cant tell if its "HR 108" or "ELB 108" right now it just says: "110 310 302 304 306 318 319 320 321 322 323" for example but I need it to say "HR 110, ELB 226, ELB 330" and so on.
Now the problem is that I cant figure out how to join all this. I got data I need from multiple tables and the building name is in a seperate table.
This screenshot might help: http://img125.imageshack.us/img125/6976/chart8ek.jpg