> 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