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 to increment dates by 1 in mysql?

544


What are the indexes in mysql?

495


Are stored procedures precompiled?

508


What do you mean by % and _ in the LIKE statement?

532


How many columns is too many mysql?

466






What is a join? Explain the different types of mysql joins.

686


What is unsigned in mysql?

504


Transactions are used to treat sets of SQL statements atomically. State Whether True or False?

976


How do I restart mysql on windows?

475


How to show table names with 'mysqlshow'?

536


How to create and drop view in mysql?

503


What is delimiter in mysql trigger?

518


Why do you think it is advised to not to use guid and character columns as clustered index arrays?

669


What is longblob?

533


How to convert character strings to numeric values?

610