Difference between MYSQL_ASSOC,MYSQL_NUM and MYSQL_BOTH ?

Answers were Sorted based on User's Feedback



Difference between MYSQL_ASSOC,MYSQL_NUM and MYSQL_BOTH ?..

Answer / 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

Difference between MYSQL_ASSOC,MYSQL_NUM and MYSQL_BOTH ?..

Answer / deepak sakure

difference between MYSQL_NUM AND MYSQL_ASSOC.
MYSQL_NUM returns a numerically indexed array.
MYSQL_ASSOC returns an associative array.

Is This Answer Correct ?    20 Yes 3 No

Difference between MYSQL_ASSOC,MYSQL_NUM and MYSQL_BOTH ?..

Answer / test

difference between MYSQL_NUM AND MYSQL_ASSOC.
MYSQL_NUM returns a numerically indexed array.
MYSQL_ASSOC returns an associative array.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More MySQL Interview Questions

how we can find nth max salary from an employe table by using my sql?

8 Answers  


What causes mysql too many connections?

0 Answers  


How do I setup a mysql database?

0 Answers  


How do I assign a variable in mysql?

0 Answers  


how to connect a php script with the mysql database?

0 Answers  






How do I drop a database in mysql?

0 Answers  


What?s the difference between query_cache_type 1 and 2?

1 Answers  


How do I stop a mysql command?

0 Answers  


How many ways to get the current time?

0 Answers  


Which mysql function is used to concatenate string?

1 Answers  


What are queries used for?

0 Answers  


How to see the create table statement of an existing table?

0 Answers  


Categories