Table

$q="Select * FROM tbl; $res=mysql_query($q); while($row=mysql_fetch_array($res)) { echo $row['marka']; } 

I receive -
titanium
nickel

How to get data depending on the quantity, i.e. -

titanium
titanium
titanium
nickel

  • Well, organize another cycle inside, depending on $row['shtuk'] - Alexey Shimansky
  • for a grouped query, you need distinct or group by , for example $q="select distinct marka from tbl" - nick_n_a

1 answer 1

The solution is to add a counter with reference to the pieces. Why bother to doubles? And for example, for printing labels to orders.

 $q="Select * FROM tbl; $res=mysql_query($q); while($row=mysql_fetch_array($res)) { for ($i = 0; $i < $shtuk; $i++) { echo $row['marka']; } }