I have a problem using while loop. While loop works but it does not return data in the one row. I know why it is going like that but I do not know how to fix it.
$bonusai = mysql_query("SELECT summa, date FROM tb_history WHERE type =
'bonus' AND user_id = '$usid' ORDER BY id DESC");
while ($r1 = mysql_fetch_assoc($bonusai)) { ?>
<tr>
<td>
<?php echo ($r1['summa'] == 0.01) ? date('Y-m-d H:i:s', $r1['date']) : ''; ?>
</td>
<td colspan="2">
<?php echo ($r1['summa'] == 0.01) ? '+' : ''; ?>
</td>
<td>
<?php echo ($r1['summa'] == 0.02) ? date('Y-m-d H:i:s', $r1['date']) : ''; ?>
</td>
<td colspan="2"><?php echo ($r1['summa'] == 0.02) ? '+' : ''; ?></td>
</tr>
<?php } ?>
$bonusai query results:
In the website, it looks like this:
As you can see, only one result is in the row. It should display both data in the same row like this (changed using inspect element):
In my opinion, I should change something with the if the ternary operator and while loop or change query structure. Maybe I should use nested while loop? All data are in the same MySQL table, so I cannot use JOIN. What should I use to make every MySQL record in the same row?
P.S I know, I should not use deprecated mysql_*.

