Hello,
[[newbie warning]]
Background:
My contacts database has field for first letter of named contacts -- so there are many duplicates when sql = "SELECT lettername FROM contacts ORDER BY lettername" ((yes I know that I could do "SELECT DISTINCT lettername FROM contacts ORDER BY lettername" and in fact when I do the "SLECT DISTINCT..." way  there are no duplicates and the result is as needed - but that would not help me learn to solve this ;-) )
My .html looks like:
| <tr><td valign=bottom> [blk2.lettername;block=td;ondata=f_distinct_blk2] </td></tr>
 
 | 
My .php looks like:
| function f_distinct_blk2($BlockName,&$CurrRec,$RecNum) { // this iten is diff from previous - so keep it
 if( $CurrRec['lettername'] != $CurrRec[($RecNum-1)]) {
 $CurrRec['lettername']="(".$CurrRec['lettername'].")";
 }else{
 // this one is not different - so get rid of it
 $CurrRec['lettername']=false;
 }
 }
 
 | 
The results are like (see duplicates):
 (C) (C) (G) (G) (G) (G) (H) (H) (H) (S) (W) (W)
Obviously - from the results -     I am not succeeding to compare the current val to the previous val. But I have no understanding of a way to do it otherwise.
Any help to learn what I am missing - or failing to comprehend - would be greatly apprecialed.
[[Thanks for TBS]]