Hi,
Ahhh hah! I understand what you want to do now. You want to query a database for the information in a table. Then you want to display some of the fields in a record in one table, and display other fields in the record in a second table, and then display the rest of the fields in the record in a third table. Right?
Ok, you tried this:
reset ($row);
That doesnt work because $row is a "horizontal" array containing the fields of one record. So, at the most you would be resetting the array $row that contains one record back to the first field in that record; but, in fact, the while loop terminates when there are no more $row's left, so you are trying to reset a variable that contains nothing. What you should try to do is use reset() on $result which contains a "vertical" array of all the records to try and reset it back to the first record. I don't know if that will work because $result is what is called a "result identifier", so I do not think it is really an array, but try it and see if it works.
To get around that problem if reset($result) doesn't work, you could try this, but I have a feeling it might not work either:
$temp=$result;
while ($row=mysql_fetch_array($temp))
Something that should work is this:
Code:
while ($row=mysql_fetch_array($result))
{
$stored_records[$i]=$row;
$i++;
}
Then you will have a two dimensional array $stored_records, and you can do this:
Code:
for ($j=0; $j<count($stored_records); j++)
{
echo '<td>' . $stored_records[$j]['name'] . '</td>';
}
Finally, these statements won't work:
printf("<td>".$row["avg(visual)"],"</td>");
There is no field name called "avg(visual)" in your table is there? avg() is an sql function and can only be in a SELECT statement.
Bookmarks