Magento Expert Forum - Improve your Magento experience
-
Junior Member
What is the difference between mysql_fetch_object() and mysql_fetch_array()?
What is the difference between mysql_fetch_object() and mysql_fetch_array()?
View more threads in the same category:
-
The Following User Says Thank You to kajal For This Useful Post:
-
1) mysql_fetch_array : Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. The type of returned array depends on how result_type is defined. By using MYSQL_BOTH (default), you'll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), [by] using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).
2) mysql_fetch_row: Returns a numerical array of strings that corresponds to the fetched row, or FALSE if there are no more rows. mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.
-
-
mysql_fetch_array: returned a row from recordset as a numeric and/or associative array.
mysql_fetch_row: returned a row from recordset as a numeric array.
-
-
Junior Member
The official documentation is pretty clear on this, have you looked at it?
mysql_fetch_array returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. The type of returned array depends on how result_type is defined. By using MYSQL_BOTH (default), you'll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), [by] using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).
However, mysql_fetch_row returns a numerical array of strings that corresponds to the fetched row, or FALSE if there are no more rows. mysql_fetch_row() fetches one row of data from the result associated with the specified result identifier. The row is returned as an array. Each result column is stored in an array offset, starting at offset 0.
-
-
Mysql_fetch_object returns the result from the database as objects while mysql_fetch_array returns result as an array. This will allow access to the data by the field names.
-
-
Speed-wise, the capacity is indistinguishable to mysql_fetch_array(), and nearly as fast as mysql_fetch_row() (the thing that matters is immaterial). mysql_fetch_object() is like mysql_fetch_array(), with one contrast - an article is returned, rather than an exhibit.
-
-
The line is returned as a cluster. Each outcome section is put away in a cluster counterbalance, beginning at balance 0. A significant number of the php programming novices get confounded about mysql_fetch_array(), mysql_fetch_row(), mysql_fetch_assoc() and mysql_fetch_object() capacities, however these capacities plays out a comparative procedure.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks