Re: print single instance of identical values in multiple rows; multiple instances of unique values ?

From: Date: Sat, 02 Sep 2000 22:40:07 +0000
Subject: Re: print single instance of identical values in multiple rows; multiple instances of unique values ?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-2589@lists.php.net to get a copy of this message
Hello, I dont make a query, but create a similar situation, with articles. Anyway you have to parse the result, check the current Title and compare it to the last one. If equal dont start a new section, and print one more author, until the end of the selection. Here is a example, should work, I didnt test it. but you ve got the method // just create a array with article and author srand ((double) microtime() * 1000000); $randval = rand(); for ($i=0;$i<5;$i++){ for ($j=0;$j<=5;$j++) $maselection[] = array("idarticle"=>"article".$i,"auteurname"=>"auteur".$j); } // When it starts, prevArticle = 1st Article $prevArticle= $maselection[0]["idarticle"]; while (list($key,$value)=each($maselection)){ $currentArticle = $value["idarticle"]; if($currentArticle == $prevArticle){ print $value["auteurname"]."/"; }else{ print $prevArticle."<BR><BR>"; } $prevArticle = $currentArticle; } print $currentArticle; _¸,ø¤°¯°¤ø,¸_¸,ø¤°¯°¤ø,¸_¸,ø¤°¯°¤ø,¸_ (¯·._ (¯·._--={PA Joye}=--_.·¯) _.·¯) (¯·._ (¯·._--={Fight for your mind}=--_.·¯) _.·¯) ¯°¤ø,¸_¸,ø¤°¯°¤ø,¸_¸,ø¤°¯`°¤ø,¸_¸,ø¤°¯

« previous php.db (#2589) next »