You are here: Re: how to clear an array « All PHP « IT news, forums, messages
Re: how to clear an array

Posted by Stefan Rybacki on 10/03/05 18:36

Sentinel wrote:
> Stefan Rybacki 03.10.2005 11:29:16 <3qcbvcFe3f44U2@individual.net>
> stefan.rybacki@gmx.net alt.php Stefan
>
>
>>Sentinel wrote:
>>
>>>I have an array (that is filled from mysql) first its count is 6
>>>and it has 6 items in it, second time its count is 6 but there are
>>>only 3 items in it... why does count() return 6 both times?
>>>
>>>how do i empty/clear the array?
>>>
>>
>>clear an array like this $array=array();
>>
>>Well it would help to see some of your source code that shows the
>>behaviour above.
>>
>>Regards
>>Stefan
>
>
> it is a loop: (i don't have it on this pc so here is it without the
> details)
>
> while (condition){
> $a = mysql_query("SELECT * FROM options WHERE
> optiongroup='".$arrayoptiongroup{'optiongroup_id'}."'");
> while ($arrayoptions = mysql_fetch_array($a, MYSQL_ASSOC)){
> do some stuff
> print count(arrayoptions); <--- this allways returns the same value
> as the first time
> }

Thats right, since the query delivered 6 columns? Think about it.

Regards
Stefan

 

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

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