Note that there are some explanatory texts on larger screens.

plurals
  1. POfor loop repeating same size row in shopping cart page?
    primarykey
    data
    text
    <p>i have a shoppingcart page where for loop count session cart but problem is that i'm retrieving <code>sizes</code> values from mySQL database now <code>for loop repeating single row</code> again and again with every products now i want to display different <code>sizes</code> for every products? please help me thanks in advance?</p> <p><strong>Select Size Query From MySql Table</strong></p> <pre><code>function get_size($id){ $result=mysql_query("SELECT mywishlist.`sizes` FROM mywishlist ORDER BY id DESC ") or die("Id Problem"."&lt;br/&gt;&lt;br/&gt;".mysql_error()); while($row=mysql_fetch_assoc($result)){ return $row['sizes'].'&lt;br&gt;'; } } </code></pre> <p><strong>Shopping Cart For Loop Condition</strong></p> <pre><code>&lt;?php if(is_array($_SESSION['cart'])){ $max=count($_SESSION['cart']); for($i=0;$i&lt;$max;$i++){ $id=$_SESSION['cart'][$i]['id']; $q=$_SESSION['cart'][$i]['qty']; $product=get_product_name($id); $image=get_product_image($id); $ids=get_id($id); $itemcode=get_itemcode($id); $size=get_size($id); if($q==0) continue; ?&gt; &lt;div style="margin-left: -20px;"&gt; &lt;?php echo $sizes; ?&gt; &lt;/div&gt; &lt;input type="hidden" name="size[]" value="&lt;?php echo $sizes; ?&gt;" /&gt;&lt;/td&gt; &lt;?php } } ?&gt; </code></pre> <p><strong>Even I have tried with the help of Session But Still Same Problem</strong></p> <pre><code>$sizes=$_SESSION['sizes1']; </code></pre> <p><strong>My MySQL Table Picture I have Two DIfferent Sizes</strong></p> <p><img src="https://i.stack.imgur.com/rt3xr.png" alt="enter image description here"></p> <p>**SHopping Cart Page ** <img src="https://i.stack.imgur.com/NA8Fb.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload