Rich,

Thanks! You pointed me in the right direction and I now have the code
working and returning the expected results. If anybody's interested, just
post back to the list and I'll post the working code. Don't want to bog the
list down if nobody cares.

Rich

> -----Original Message-----
> From: Rich Gray [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 06, 2003 10:05 AM
> To: Hutchins, Richard; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Populate Array During Loop With in_array
> 
> 
> > Can somebody please tell me why the $displayThese variable 
> in the code
> > snippet below only gets populated with the last value in the
> > $newsList array
> > even when $newsList has more than one row of data?
> >
> >             while($newsList = mysql_fetch_array($result_getNews)){
> >                     if($convReadList != ""){
> >                             for($i = 0; $i < $countNewsItems; $i++){
> >                                     if (!in_array($newsList[$i],
> > $convReadList)){
> >                                             //echo 
> $newsList[$i]." was
> > found\n";
> >                                             $displayThese[$i] =
> > $newsList[$i];
> >                                     }
> >                             }
> >                     }
> >                     else{
> >                             echo "<p>readList is empty</p>";
> >                     }
> >             }
> >             print_r($displayThese);
> >
> >
> 
> You're resetting $i back to 0 for each row returned from the 
> database. So if
> there are multiple rows (which you say there are) then the 
> array entries
> will get overwritten each time...
> 
> HTH
> Rich
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to