You are here: Re: Rookie PHP/MySQL Question « All PHP « IT news, forums, messages
Re: Rookie PHP/MySQL Question

Posted by Ian Rutgers on 10/10/97 11:33

"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:dmmjsg$ug5$1@netlx020.civ.utwente.nl...
> Ian Rutgers wrote:
>> and $my_array[] now stores the corrent number of image names!! Why
>> does the foreach(....) duplicate the entries?
>
> foreach isn't the problem.
>
> mysql_fetch_array does this:
>
> www.php.net:
> mysql_fetch_array -- Fetch a result row as an associative array, a numeric
> array, or _both_
>
> So is returns both numeric and named arrayvalues.
> (For example: [key] => value:
> [0] => value1
> [name1] =>value1
> [1] => value2
> [name2] => value2)
>
> Use mysql_fetch_assoc, or mysql_fetch_array($bla, MYSQL_ASSOC) or
> mysql_fetch_array($bla, MYSQL_NUM).
>
> In the second example you're only checking for named values, so it returns
> just the one set, in the first you're accessing all values, also the
> numeric.
>
> Grtz,
>
> Rik
>
>
Thanks for the education!

 

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

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