Guest PJ Posted February 3, 2009 Report Share Posted February 3, 2009 G'day, i've got a script i've done, but isn't working entirely the way it should be. Currently the results display like so: Room 1, Teacher 1, Student 1 Room 1, Teacher 1, Student 2 Room 1, Teacher 2, Student 3 Room 1, Teacher 2, Student 4 Room 1, Teacher 2, Student 5 Room 1, Teacher 3, Student 6 Room 2, Teacher 4, Student 7 Room 2, Teacher 5, Student 8 Room 2, Teacher 5, Student 9 where by I want it to show Room 1 Teacher 1, Student 1, Student 2 Teacher 2, Student 3, Student 4, Student 5 Teacher 3, Student 6 Room 2 Teacher 4, Student 7 Teacher 5, Student 8, Student 9 So as you can see, column 1 field only displays the room # once, then in the next column displays the Teachers name once and displays all the students beside that. And this is the current code i've got, but unsure where to go from here! <? $classes=mysql_query("select room, teacher, student from schooldb ORDER BY room ASC, teacher ASC, student ASC "); while($row_classes=mysql_fetch_assoc($classes)) { // Show records by while loop. echo " "; echo $row_list3[room]; echo " "; echo $row_list3[teacher]; echo " - "; echo $row_list3[student]; echo " "; } ?> I realise there is currently no table format setup, that comes later when I finish designing it, at the moment I just want to get the script working the way I prefer please. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.