halm1985 Posted July 8, 2007 Share Posted July 8, 2007 Can someone tell me what is the difference between the two functions ? When to use each ? OR is one of them a special case of the other ? Link to comment https://forums.phpfreaks.com/topic/58936-mysql_fetch_array-mysql_fetch_assoc/ Share on other sites More sharing options...
wildteen88 Posted July 8, 2007 Share Posted July 8, 2007 mysql_fetch_array returns both an associative array (eg $row['id'], $row['name'] etc) and a numerical array (eg: $row[0] - first row, $row[1] - secound row). mysql_fetch_array does have an optional second parameter for what type of array you want that function to return. The options are MYSQL_ASSOC, MYSQL_NUM, or MYSQL_BOTH (default) MYSQL_ASSOC - return an associative array (same as mysql_fetch_assoc()) MYSQL_NUM - return a numerical array (same as mysql_fetch_row()) MYSQL_BOTH - return both an associative array and numerical array (default behaviour). mysql_fetch_assoc returns just an associative array. Link to comment https://forums.phpfreaks.com/topic/58936-mysql_fetch_array-mysql_fetch_assoc/#findComment-292450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.