182x Posted August 16, 2007 Share Posted August 16, 2007 Hey guys, I am just wondering why the following code works.. shouldn't it be an mysql_fetch_assoc instead as its not using the index but a name instead? Thanks. <?php while($var=mysql_fetch_array($queryResult)) { echo "<tr><td>".$var['name']."</td></td><td>".$var['job']."</td></tr>"; } ?> Quote Link to comment Share on other sites More sharing options...
Orio Posted August 16, 2007 Share Posted August 16, 2007 mysql_fetch_array() from the manual: mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both In this case (when you dont specify a result type) it returns both, so yes, this will work. Orio. Quote Link to comment Share on other sites More sharing options...
182x Posted August 16, 2007 Author Share Posted August 16, 2007 Ah i see, thanks and sorry for the newbie question Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.