Re: mysql_fetch_array()
| From: | Chris Shiflett | Date: | Wed, 18 Aug 2004 03:26:36 +0000 |
| Subject: | Re: mysql_fetch_array() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194118@lists.php.net to get a copy of this message | ||
--- Anthony Ritter <tony@gonefishingguideservice.com> wrote:
> When using mysql_fetch_array() is it necsessary to specify the
> second argument - meaning the constant of MYSQL_NUM or
> MYSQL_ASSOC?
Whenever you have a question about a function, you can look it up using a
URL formatted as follows:
http://www.php.net/mysql_fetch_array
Here, you will see:
"The optional second argument result_type in mysql_fetch_array() is a
constant and can take the following values: MYSQL_ASSOC, MYSQL_NUM, and
MYSQL_BOTH. This feature was added in PHP 3.0.7. MYSQL_BOTH is the default
for this argument.
By using MYSQL_BOTH, you'll get an array with both associative and number
indices. Using MYSQL_ASSOC, you only get associative indices (as
mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices
(as mysql_fetch_row() works)."
Hope that helps.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly
Coming Fall 2004
HTTP Developer's Handbook - Sams
http://httphandbook.org/
PHP Community Site
http://phpcommunity.org/