How to break the table row with mysql data

-5

Hello, I made a request system and I would like to know how I can do to break the line after the commas. So when I print the application in the kitchen it comes as follows

Tambaqui Rib: 1

Fake Smoking: 1

Fanta Orange: 1

Fanta laran ja 2l: 1

and the printing will make the order more organized, and next to quantities.

How could I do it, I'm grateful already.

Code

<table><thead><tr><th>Comanda</th><th>N°Mesa</th><th>Refeição</th><th>Quantidade</th><th>Bebida</th><th>Quantidade</th><th>Data</th><th>Acão</th></tr></thead><tbody><tr><?phpwhile($row=mysqli_fetch_array($consulta)){echo'<tr>';echo'<td">'.$row["id_pedido"].'</td>';
                echo '<td ">'.$row["numero_mesa"].'</td>';
                echo '<td  >'.$row["pedido_refeicao"].'</td>';
                echo '<td >'.$row["num_refeicao"].'</td>';
                echo '<td >'.$row["pedido_bebida"].'</td>';
                echo '<td >'.$row["num_bebida"].'</td>';
                echo '<td >'.date("d/m/y H:i:s", strtotime($row["data"])).'</td>';

                echo '</tr>';

            }
                ?>
                <td><a href="form_alteracao.php?codigo=<?php echo $dado["usu_codigo"];?>">editar</a>
    </tr>
    <thead>
<table>
    
asked by anonymous 29.01.2017 / 00:27

1 answer

2

You have to manipulate the string before printing it using some functions within a cycle

<?php
$str = "abc, xyz, 123";

for( $i = 0; $i < strlen($str); $i++){
  $char = substr($str, $i, 1);
  if ($char == ","){
    $str = substr_replace($str, "<br>", $i+1, 0);
  }
}

echo "$str";
?>

For this code the output is:

abc,
xyz,
123
    
29.01.2017 / 03:01