Difference between mysql_fetch_array(),mysql_fetch_row() and mysql_fetch_object()

mysql_fetch_array():: fetches a result row as a associated array, numeric array

mysql_fetch_row::fetches a result row as array

mysql_fetch_object: Fetaches a result row as object.

MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array
my fetch row fetch a result row as array

mysql_fetch_array ? Fetch a result row as an associative array, a numeric array, or both. Returns an array that corresponds to the fetched row and moves the internal data pointer ahead.

mysql_fetch_object ? Fetch a result row as an object. Returns an object with properties that correspond to the fetched row and moves the internal data pointer ahead.

mysql_fetch_row ? Get a result row as an enumerated array. Returns a numerical array that corresponds to the fetched row and moves the internal data pointer ahead.

Advertisements

About amitsonikhandwa
I am a web developer working in PHP and MYSQL with AJAX, jQuery and JavaScript. I am in web development since 2007.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s