random -n lines array problem

From: Date: Fri, 07 Mar 2003 04:51:10 +0000
Subject: random -n lines array problem
Groups: php.general 
Request: Send a blank email to php-general+get-138546@lists.php.net to get a copy of this message
the code only displays the 10 random line numbers somehow again the arrays are empty, tried all tricks to see if arrays are carrieng anything but the are all empty data file loks like : 123|name|LastN|City|Country|||etc|etc| 124|names|lastN|||etc||etc| could somebody please find the error, thanks for any help // Code start <?php $i = 0; $fp = fopen ("./../../cgi-bin/Classifieds/data/ads.data", "r"); while($tmp= fgetcsv($fp,50000,"\|")) { $array[]=$tmp; } fclose ($fp); $rand_array=array_rand($array, 10); foreach($rand_array as $line) { list($adnr, $user, $date, $listed, $hlong, $eins, $zwei, $drei, $vier, $usern, $locst, $locstaa, $locc, $funf, $sech, $email, $Url, $ClassCat, $ClassCat2, $Headstart, $Headend, $Descrip, $End1, $Endzwei, $End3, $Endvier, $Endfunf, $Endsech, $Endsieben, $Endacht, $Endne, $dreizwei, $dreidrei, $dreivier, $dreifunf, $dreisechs ) = ($line); echo " <font face=\"Verdana\" size=\"1\"><a href=\"../../cgi-bin/Classifieds/classifieds.cgi?session_key=&search_and_display_db_button=on&db_id=$adnr&query=retrieval\" target=\"_blanko\">$Endzwei $End3 </a><br></font>"; } // code end

« previous php.general (#138546) next »