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 ? Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.