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 to concatenate two character strings?

0 Answers  


How do I drop a database in mysql?

0 Answers  


How is data stored in mysql?

0 Answers  


What is mysql used for?

0 Answers  


What is definer in mysql?

0 Answers  


What is blob storage?

0 Answers  


What is memory table in mysql?

0 Answers  


In the below example, how many String Objects are created? String s1="I am Java Expert"; String s2="I am C Expert"; String s3="I am Java Expert";

1 Answers  


What mysql -u john -p command does?

0 Answers  


how we can use more then one primary key in Single Table

9 Answers   Systematix,


How to use count function in mysql?

0 Answers  


Explain the difference between mysql and mysqli interfaces in PHP?

10 Answers   TCS,


Categories