I'm completely new at this, and the book I purchased on PHP does not show examples of how to write mysql queries based on relational databases. They only show how to retrieve data from 1 database at a time.

Can someone give me some example queries. I would greatly appreciate the help. Here are the tables I am working with:

Database name: du

tables:

Student
ID
FirstName
LastName
College
Major
PhoneNumber
GPA

Classes
ID
Course
Section
Credits
StudentID <---relational to ID in Student table

This query works in Mysql, but not in php:
SELECT Classes.Course, Classes.Section,Classes.Credits,Classes.Term,Student.FirstName,Student.LastName,Student.College,Student.Major,Student.PhoneNumber,Student.GPA FROM Classes, Student WHERE Student.ID = Classes.StudentID;



If you are curios, let me explain what I am doing. I have 2 tables in the database "du". The tables are "Student" and "Classes". I intend to have multiple records in "Classes" for each "Student". I know I should break classes into 2 separate databases, but there are way too many classes I would have to input, so I want to keep it the way it is(even though there will be redundant data). I'm doing this for my organization in College. A study group / reporting database in a sense.

Thanks a lot.