First, I admit to being VERY new to PHP and mySQL and, to make matters
worse, I'm self-taught..

If you visit the demo site at you might better
understand what I'm attempting to do and that might help better explain my
confusion with your suggestion.

The Parent Log displays the existing data for each week (up to the current
week, but not into the rest of the school year) divided into eight possible
types of work.

This is what the sql looks like:

$sql = "
 SELECT weeks.*, parentlog.*
 FROM weeks LEFT JOIN parentlog USING(week_no)
 WHERE parentlog.parent_id = \"$parent_id\"
 AND parentlog.student_id = \"$student_id\"
 AND week_date <= CURRENT_DATE

The _existing_ values are placed in the VALUE for each form input in code
like this:

<input type=\"text\" name=\"classroom\" value=\"$classroom\" size=\"2\"
Hidden values for the $week_no, $parent_id and $student_id are included in
each row.

Since I'm starting with the existing value for each field, I'm confused by
your suggestion that the name reference as an array would be different from
the value reference.

What I'm shooting for is the ability of the parent to change any existing
value in any field in any week and then press a single Update button and
have all of the values updated.

John Hughes

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

> Actually, you want the value of the input to be just "$classroom".  That
> because it is within the while loop.  Can I ask for a little more
> information regarding the structure of the table that you are
> is(are) the primary keys in the table; I am assuming that the "week_no"
> field is the primary key.  I am sorry for the confusion--the complete code
> for outputting the input form follows (minus the appropriate form tags).
> ###SNIP####
> echo "<table>";
> 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'];
>  echo <<<EOD
> <tr><td align=\"center\">
>   <input type=\"text\" name=\"log[$week_no][classroom]\"
> value=\"$classroom\">
> </td></tr>
> EOD;
> }
> echo "</table><";
> ###SNIP####
> > -----Original Message-----
> > From: John Hughes, Jomari Works [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, March 11, 2002 11:03 PM
> > To: Shrock, Court; [EMAIL PROTECTED]
> > Subject: Re: [PHP-DB] Creating an array of mySQL results with PHP
> >
> >
> > 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?
> --
> PHP Database Mailing List (
> To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to