Greetings, I'm working on a system to track homework and assignments for teachers/students. I'm in high school, and I decided I was sick of writing down the homework for the day, so I'm building a site that will allow teachers to post assignments/homework for each of their classes. Students can then go online and view it, but I digress.
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. Thanks for your time, Blaine von Roeder PS: I'm sort of new to the entire PHP scene(learning as I go) so if there are any tweaks or optimizations I can use(such as not using that unwieldy switch with lots of nearly identical code), please let me know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php