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

Write a query to fetch duplicate records from a table using mysql?

0 Answers  


What are the non-standard sql commands supported by 'mysql'?

0 Answers  


How to do login in mysql with unix shell.

0 Answers  


How is oracle different from mysql?

0 Answers  


what is the difrence between sql and pl/sql

21 Answers   Wipro,






What is sharding in mysql?

0 Answers  


How do I create a mysql database?

0 Answers  


What is the default port of mysql server?

0 Answers  


What is prepared statement in mysql?

0 Answers  


How to convert dates to character strings?

0 Answers  


Explain the difference between FLOAT, DOUBLE and REAL.

14 Answers   Yahoo,


What is mysql_query?

0 Answers  


Categories