Reply to Re: how to clear an array

Your name:

Reply:


Posted by Sentinel on 10/03/05 17:32

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
}

}


the scripts first reads menu headers from db, prints one header and
then reads options for that header and prints them, then it prinst the
next header and reads ist options from db... and so on...

the goal is:
next to every option i have two images
except the first option in array has only the first image
and the last option in array has only second image

since i allways know which is the first option - the first part was no
problem

but when i try to use count(array), first time it returns correct
value, but every other time it returns wrong value (the value that it
returned the first time). it doesnt matter if the number of records has
increased or decreased...

--
Will work for bandwidth!

[Back to original 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

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