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>"; } ?> Link to comment https://forums.phpfreaks.com/topic/65200-solved-array-question/ 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. Link to comment https://forums.phpfreaks.com/topic/65200-solved-array-question/#findComment-325569 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 Link to comment https://forums.phpfreaks.com/topic/65200-solved-array-question/#findComment-325570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.