Simon,
I posted on the other site. I'm not clear on your design.
I also wanted to say, when you create your query, you have understand what you want back. Very often when you have a 'parent - child' relationship, you'll write a left join query that brings back a result set of both tables. You only display
For example, if you displayed ALL the orders student #49 has, and lets say they have three orders.
SELECT std.std_id, std.f_nm, std.l_nm, std.addr, std.bal, ord.ord_id, ord.std_id, ord_total FROM student std LEFT JOIN order ord on ord.std_id = std.std_id WHERE std.std_id ='49'
This type of query returns three rows, each of those rows has the exact same student id, student first namd, student last name (std_id, f_nm, l_nm). So when you loop through this you'll retrieve the student information once and each unique order this student has.
Hope that helps
Good Design, Saves Time