Arrays and multiple SQLs (maybe)
We have a web based app, that allows parents to login and check on thier kids (attendance, visits to the princiapl, grades, etc.) Well, a parent may have more than one kid in the school, so we want to present them with a list of their kids, and they can clikc on whatever kid they want to get info on. When a parent logs in, we check a "users" table for that parent, and they grab their relevant ID and off they go.
So when we build the list of kids to display them, the SQL goes (in everyman's englisg translation here): "SHOW me all KIDS WITH PARENT ID [parent id]". Well, here's the problem. If a parent has three kids, she will have 3 parent ID entries in the user table, and it appears that upon loggin in, she simply grabs the first ID. So the SQL only ever returns 1 kid.
So, now I need a SQL that goes kinda like this: "SHOW ME ALL IDS associated with PARENT", then "SHOW ME ALL KIDS WITH PARENT ID [p1]" then "SHOW ME ALL KIDS WITH PARENT ID [p2]" etc. until we run out of parent IDs. And to complicate it further, we present the list as a clickable HTML List of kids:
<h1>Parents Main Menu</h1>
<p>Please choose a student</p>
<a href="contacts_set_student.php?studentid=<? echo $studentid; ?>" class="aform"><?echo $student->studentbio_fname. " " .$student->studentbio_lname; ?></a><br>
I presume I need to build some sort of array, and then a for each loop. Any help anyone?