Re: An extra last empty field in an 'mysql_fetch_array' result array?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: An extra last empty field in an 'mysql_fetch_array' result array?

From: brekelm <marcel@marcel-art.com>
Date: Fri Oct 14 2005 - 15:07:18 CEST

Peter van Schie schreef:

> Marcel Brekelmans wrote:
> > The following code:
> >
> > $oCursor = mysql_query("SELECT ID from tblName WHERE Name='Jane'");
> > if (!$oCursor)
> > {
> > $bGo = false;
> > }
> > else
> > {
> > $aRow = mysql_fetch_array($oCursor);
> > }
> >
> > results in:
> >
> > count($aRow) = 2;
> >
> > $aRow[0] = 1;
> > $aRow[1] = '';
>
> Marcel,
>
> mysql_fetch_array by default fetches the result both as an associative
> array and a numeric array. It has two parameters, the second parameter
> is either MYSQL_ASSOC, MYSQL_NUM or MYSQL_BOTH, default is MYSQL_BOTH.
> Doing a print_r($aRow) will show this too.
>
> HTH.
> Peter.
> --
> http://www.phpforums.nl

Thanks Peter, that was the solution: using the MYSQL_NUM parameter
restricted the output to the single value I expected.
Received on Tue Oct 18 02:41:25 2005