gj0519 Posted April 22, 2009 Share Posted April 22, 2009 I currently have a script that I use a while loop to get my data. What I am trying to figure out is a way to eliminate any records that are duplicates, like if 2 dates are the same to only show 1. I have attached a png of what my output currently looks like. Here is what my code is so far. $message=""; while($list=mysqli_fetch_array($result)) { $date=$list['gm_date']; $time=$list['gm_time']; $gid=$list['gameid']; $fldname=$list['fld_name']; $tname=$list['team_name']; $rlname=$list['ref_lname']; $message.="<tr> <td>$date</td> <td>$time</td> <td>$gid</td> <td>$fldname</td> <td>$tname</td> <td>$rlname</td> </tr>"; Thanks, GJ [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/155266-loop-question/ Share on other sites More sharing options...
sdi126 Posted April 22, 2009 Share Posted April 22, 2009 the best solution would be to limit the data returned from your mysql query have you tried using the keyword 'DISTINCT' in your query...just before the column 'gm_date'? Link to comment https://forums.phpfreaks.com/topic/155266-loop-question/#findComment-816941 Share on other sites More sharing options...
Gighalen Posted April 22, 2009 Share Posted April 22, 2009 http://www.w3schools.com/sql/sql_distinct.asp bow chica bow wow Link to comment https://forums.phpfreaks.com/topic/155266-loop-question/#findComment-816943 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.