<? //store as multidimesion arry element for simlipicity $data[0]=array ( "1","name1","surname1","client1"); $data[1]=array ( "2","name2 ","surname2 ","client2"); $data[2]=array ( "3","name3 ","surname3 ","client3"); $data[3]=array ( "4","name1 ","surname1 ","client4"); $data[4]=array ( "5","name5 ","surname5 ","client5"); $data[5]=array ( "6","name2 ","surname3 ","client6"); sort($data); $total=count($data); $prev=""; for($i=0;$i<$total;$i++) { $current=$data[$i][1].":".$data[$i][2]; //echo "\n $prev $current"; if($prev!=$curent) { echo " ".$data[$i][0]."=>".$data[$i][1]." ".$data[$i][2] ." Manages ".$data[$i][3].".\n "; } $prev=$current; }
?> On Thursday 08 August 2002 05:27 pm, Poonam P wrote:
Req.: Have an array of Name & surname & Client_code. Need to print a list without LISTING PEOPLE WITH SIMILAR "NAME & "SURNAME" IN THE ARRAY more than once.
Eg. 1: name1 : surname1 : client1 2: name2 : surname2 : client2 3: name3 : surname3 : client3 4: name1 : surname1 : client4 5: name5 : surname5 : client5 6: name2 : surname3 : client6
In the above example, record 1 & 4 are same guys. And I have to list them only once.
What I have done so far is....
for ($i = 0; $i < 6; $i++) { printf ($name[$i] . $surname[$i] . " manages " . $client[$i] \n"); } // end $i
But this prints same people multiple times...
Pls help. Pls do not suggest changing variables etc etc... Thx Poonam.
Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! visit http://in.autos.yahoo.com _______________________________________________ http://mm.ilug-bom.org.in/mailman/listinfo/linuxers