You are here: Re: An extra last empty field in an 'mysql_fetch_array' result array? « PHP Programming Language « IT news, forums, messages
Re: An extra last empty field in an 'mysql_fetch_array' result array?

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация