I am writing a program that will basically take students and put them into classes. Each class has its own table, and i have a main table of students information such as name, major, etc. What i am trying to do is if the user wants to bring up the roll of the class say for 2007001 it will grab the information from that table which is their student id then i want it to look at the student table and grab the rest of their information and output it in the screen. I figured out how to do it in sql but i am having a hard time converting it to php. Any help would be greatly appreciated. The sql is as follows:
SELECT
students.first,
students.last,
students.sid,
students.major,
students.year
FROM
students ,
2007002 ,
2007001
WHERE
2007001.sid = students.sid
Also in the SQL i can not get it to output anything other than the first name. Kinda weird.