Posted by brekelm on 10/14/05 16:07
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.
[Back to original message]
|