gcox<add the at symbol in <"here>freeuk.com"wrote:
just as a matter of interest! I have the
while ($row[] = mysql_fetch_array($result)) {
printf("<td valign='top'><strong>Venue</strong></td><td _
valign='top'>%s </td></tr>",$row[0]["venue"]);
ie $row[] and
$row[0]["venue"]
typeof code on another web site and it seems to work OK. What is the
difference between thie above and using
$row and $row["venue"] ??
$row[] = will add the result as an array to the array $row.
So if the result of mysql_fetch_array() is:
array('id' ='123','venue' ='the shed');
$row[] = mysql.... will result in $row being:
array(
0 =array('id' ='123','venue' ='the shed'));
(and running is again would result in $row being:
array(
0 =array('id' ='123','venue' ='the shed')
1 =array('id' ='456','venue' ='under the couch'));
$row = mysql.... will result in $row being:
array('id' ='123','venue' ='the shed'));
And overwrite $row with the following results on every loop.
The [] is often used when the result has to be looped several times, or
the entire resultset has to be passed as an array to another piece of code.
Using $row[0]["venue"] is only usefull if you're only interested in the
first result (in which case the while loop is unneccesary overhead).
--
Rik Wasmus
Posted on Usenet, not any forum you might see this in.
Ask Smart Questions:
http://tinyurl.com/anel