while(x < 20 && $row = mysql_fetch_array($result)){ if($row['command'] === 'Deposit' || $row['command'] === 'Withdraw' || $row['command'] === 'Interest'){ $x = $x + 1; echo' '.$row['command'].' '.$row['date'].' L$'.$row['money'].' L$'.$row['balance'].' '; } }