OK. I can see how that works, assuming that the value would be
\"log[$week_no][classroom]\" as well.

What would the mysql_fetch_array look like?

----- Original Message -----
From: "Shrock, Court" <[EMAIL PROTECTED]>
To: "'John Hughes, Jomari Works'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, March 11, 2002 10:50 PM
Subject: RE: [PHP-DB] Creating an array of mySQL results with PHP


> Well, you could use the power of PHP arrays and just name your input
fields
> in such a way that would create an array upon submittal.  For example:
>
> <td align=\"center\">
>   <input type=\"text\" name=\"log[$week_no][classroom]\"
> value=\"$classroom\">
> </td>
>
> Then, after submittal, you just loop through the array $log like such:
>
> foreach($log as $week_no => $data) {
>   $sql = "UPDATE table SET classroom='{$data['classroom']}' WHERE
> week_no=$week_no";
>   mysql_query($sql);
> }
>
> Of course, this all assumes that the key is week_no.  Hope this helps,
> Court
>
> > -----Original Message-----
> > From: John Hughes, Jomari Works [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, March 11, 2002 10:42 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-DB] Creating an array of mySQL results with PHP
> >
> >
> > while ($row = mysql_fetch_array($result)) {
> >  $week_no = $row['week_no'];
> >  $week_date = $row['week_date'];
> >  $parent_id = $row['parent_id'];
> >  $student_id = $row['student_id'];
> >  $class_id = $row['class_id'];
> >  $classroom = $row['classroom'];
> >  $homework = $row['homework'];
> >  $library = $row['library'];
> >  $fieldtrip = $row['fieldtrip'];
> >  $pta = $row['pta'];
> >  $mast = $row['mast'];
> >  $meetings = $row['meetings'];
> >  $other = $row['other'];
> >
> > I then create a table row of the result and loop through.
> >
> > A sample table cell looks like this:
> >
> > <td align=\"center\">
> >   <input type=\"text\" name=\"classroom\"
> > value=\"$classroom\" size=\"2\"
> > maxlength=\"4\">
> >   </td>
> >
> > How would I change the mysql_fetch_array to create an array
> > of weeks and how
> > would I change the table output coding to accommodate such an array?
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to