I have encountered a problem when retrieving rows from mysql database using loops but OK for typing many rows
Successful case:
<? while ($row=mysql_fetch_array($result)){ ?>
<tr>
<td><? echo $row[mysql_field_name($result,0)] ;?></td>
<!td><!? echo $row[mysql_field_name($result,1)] ;?><!/td>
<!td><!? echo $row[mysql_field_name($result,2)] ;?><!/td>
<!td><!? echo $row[mysql_field_name($result,3)] ;?><!/td>
<!td><!? echo $row[mysql_field_name($result,4)] ;?><!/td>
</tr>
<? } ?>
</table>
Fail case:
$j=0;
<? while ($row=mysql_fetch_array($result)){ ?>
<tr>
<td><? echo $row[mysql_field_name($result,$j)] ;?></td>
<? $j++; >
</tr>
<? } ?>
</table>
So would anyone tell me how can I use loops to retrieve rows.Thx