php - query results and loop them into a table by category -


i'm trying query products table;

+-------------------+--------------+------+-----+---------+----------------+ | field             | type         | null | key | default |          | +-------------------+--------------+------+-----+---------+----------------+ | id                | int(11)      | no   | pri | null    | auto_increment | | name              | varchar(50)  | no   |     | null    |                | | make              | varchar(50)  | no   |     | null    |                | | email             | varchar(200) | no   |     | null    |                | | category          | longtext     | no   |     | null    |                | +-------------------+--------------+------+-----+---------+----------------+ 

i want query database , echo results in table so, want echo category name echo contain name, make , other details etc..

i want show so;

category: name       name       name       name ------------------------------------- category: name       name       name       name ------------------------------------- category: name       name       name       name ------------------------------------- category: name       name       name       name ------------------------------------- 

where each name different product in product table. not sure , search for.

**check this**  $get_query="select * products"; @$show_pro=mysqli_query($conn,$get_query);  echo '<div id="show_table" height:400px;">'; echo '<table id="show" border="1" bordercolor="#000000">         <tr>             <th> id </th>             <th> name </th>             <th> make</th>             <th> email</th>             <th> category </th>          </tr>';  while($row_pro = mysqli_fetch_array($show_pro, mysqli_both)) {     $id = $row_pro['id'];     $name = $row_pro['name'];     $make= $row_pro['make'];     $email= $row_pro['email'];     $category = $row_pro['category'];       echo '          <tr>         <td width="50" >"'.$id.'"</td>         <td width="50">"'.$name.'"</td>         <td width="50">"'.$make.'"</td>         <td width="50">"'.$email.'"</td>         <td width="50">"'.$category.'"</td>         </tr>        ';  } echo'</table>'; echo '</div>'; 

Comments