Jump to content

fetch data


jwilson122

Recommended Posts

Okay so, I have always been curious, just never have taken the time to ask someone / learn what the differences are in fetches. What does mysql_fetch_array and mysql_fetch_row do thats different from each other? When pulling data from the database, would I like fetch array, or fetch row? or even fetch assoc? Thanks!

Link to comment
Share on other sites

The mysql_fetch_row() function returns a row from a recordset as a numeric array.

 

The mysql_fetch_array() function returns a row from a recordset as an associative array and/or a numeric array.

 

The mysql_fetch_assoc() function returns a row from a recordset as an associative array.

 

This function gets a row from the mysql_query() function and returns an array on success, or FALSE on failure or when there are no more rows.

 

Link to comment
Share on other sites

The mysql_fetch_row() function returns a row from a recordset as a numeric array.

 

The mysql_fetch_array() function returns a row from a recordset as an associative array and/or a numeric array.

 

The mysql_fetch_assoc() function returns a row from a recordset as an associative array.

 

This function gets a row from the mysql_query() function and returns an array on success, or FALSE on failure or when there are no more rows.

 

Okay cool thanks. So which should I use when I pull information from the database just to store in variables and echo out? And, which one should I use for a while loop?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.