Jump to content

Recommended Posts

Hello ,

I'm a newbie in PHP but I have tried so much but nth work !

I want to print out products into categories like this way :

 

Category 1 :

  1. product 1
     
  2. product 2
     
  3. product 3

Category 2:

  1. product 5
     
  2. product 7

and so on ..

 

This is my code which I'm using :

 

 

$get_products = mysql_query("select * from ((product join category on cid = p_cid) join restaurant on rid = c_rid) join restaurant_type on rtid = r_rtid
where rid = '$rest_id' order by rid, c_sortval, p_sortval");

while ($get_productsrows = mysql_fetch_assoc($get_products)) {


echo ' <div class="product-box" id="products-box">

<table width="100%;">';

echo '<tr id="'.$get_productsrows['pid'].'" rel="desc" title="' . $get_productsrows['p_desc'] . '" >
<td style="font-weight: bold;font-size:13px;" ><span class="name">' . $get_productsrows['p_name'] . '</span></td>
<td style="text-align:center;font-size:11px;" >JD <span class="price">' . $get_productsrows['p_price'] . '+</span></td>
<td style="text-align:center;"><input type="submit" value="Add" class="btn-add"></td>
</tr>


</table></div>';

 

This is only print out the all products for all categories for the restaurant ID .

Link to comment
https://forums.phpfreaks.com/topic/269781-print-out-products-into-categories/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.