Simple question I guess, how do I check if the row was grouped in a while loop. I want to be able to determine if it was grouped so I can change the text that is echoed if it is grouped but keep the rows that aren’t grouped the same. I hope that this makes sense as I am not sure how else to explain it.
This is the code I have
if($r['type'] == "Wall"){
$offern = $r['aff'];
}else{
$offern = $offn['name'];
}
// IF GROUPED $r['user_id'] <- It is grouped by `user_id` -> $offern = "Several";
print "<tr>
<td></td>
<td><a href='lockedf.php?id=".$r['user_id']."'>{$namess['username']}</a></td>
<td>".$offern."</td>
<td>{$r['point']} Points</td>
<td>".date("m/d/Y h:i:s A", $r['date_submitted'])."</td>
<td><a href='unlock.php?id={$r['id']}' class='ask'><img src='images/unlock.png' alt='' title='' border='0' /></a></td>
<td><a href='deny.php?id={$r['id']}' class='ask'><img src='images/trash.png' alt='' title='' border='0' /></a></td>
</tr>";
So, if you had data like this:
And a query like this:
And your goal was to figure out which user (user 1 in this case) might be missing candy because it was grouped on…you could do this:
Or, limit it to just users who are grouped like this: