Difference between MYSQL_ASSOC,MYSQL_NUM and MYSQL_BOTH ?

Answer Posted / avanthi g

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.

Example:
MYSQL_NUM returns a numerically indexed array.
$row = mysql_fetch_array($result, MYSQL_NUM);
echo $row[0];

MYSQL_ASSOC returns an associative array.
$row = mysql_fetch_array($result, MYSQL_ASSOC);
echo $row["student_id"];

MYSQL_BOTH returns both.
$row = mysql_fetch_array($result, MYSQL_BOTH)
echo $row[0]." ".$row["name"];

Is This Answer Correct ?    46 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you backup a database in mysql?

747


How to check server status with 'mysqladmin'?

761


What is difference between microsoft sql and mysql?

664


How to create a test table in your mysql server?

712


What happens when the column is set to AUTO INCREMENT and if you reach maximum value in the table?

720


How to get a version of mysql?

736


Is mysql good for big data?

667


How to use triggers to track changes in mysql?

655


What does mysql flush tables do?

716


Explain the difference between mysql and mysql interfaces in php?

742


Is mysql and sql are same?

688


What you can use regular expression for in mysql? Support your answer with an example?

637


What is mysql procedure?

688


What is mysql in linux?

685


Which is faster mongodb or mysql?

645