On Wednesday 29 January 2003 13:31, Blaine von Roeder wrote: > I'm working on the part of the site to parse your session for student id, > check the students table for your class listing(named period1, period2, > period3, etc), and then check the classes table based on the id numbers in > your students.period1(etc) fields. I've created a function for parsing the > assignments table against your session id and such, and pulling up the > posted assignments. However this is where I hit a brick wall. > > I need to pass the class_id argument to the function. I.e. class_id 1234 to > pull up all the matching assignments on class 1234. I don't know how to > pass it dynamically though, based upon the settings in your > students.user.period1. > > I was thinking along the lines of using a for statement, with a nested > switch. Here's what I've rather conjured up thusfar, which I can't get to > work. > > :::::::::::::::::::::::::::::CODE::::::::::::::::::::::::::::: > > for($i = 0;$i < 7;$i++) { > switch ($i) { > case 0: > $class_info = mysql_query("SELECT * FROM classes WHERE $id = > ".$classes_array[period0]); > $class_info_array = mysql_fetch_array($classes); > $class_id = $class_info_array[id]; > display_class_assign($class_id) > > :::::::::::::::::::::::::::::CODE::::::::::::::::::::::::::::: > > The cases are all the same, except period0 is replaced with period1, > period2, etc. up to case 7 which is periodpaws. Classes_array refers to > > this: > :::::::::::::::::::::::::::::CODE::::::::::::::::::::::::::::: > > $classes = mysql_query("SELECT period1, period2, period3, period4, period5, > period6, periodpaws, period0 FROM students WHERE id = $id"); > > $classes_array = mysql_fetch_array($classes); > > :::::::::::::::::::::::::::::CODE::::::::::::::::::::::::::::: > > I can post the code for the function if I need to, but I don't think that's > where the problem lies. The way I've set it up it works fine if i do > display_class_assigns(1234) and it pulls up the fields, displays, etc > perfectly.
What happens when you run this? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Swipple's Rule of Order: He who shouts the loudest has the floor. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php