i try to do while loop using fetchAll...but only 1st item will be the output. thanks for the help
<?php
function cart_display(){
global $db;
$ip=getIp();
$query = $db->prepare(" SELECT * FROM cart where ip_add = '$ip'");
$query->setFetchMode(PDO::FETCH_ASSOC);
$query->execute();
while ($row=$query->fetch()):
$product_id=$row['p_id'];
$query = $db->prepare("SELECT * FROM product where product_id = :product_id");
$query->bindParam(':product_id', $product_id);
//$query->setFetchMode(PDO::FETCH_ASSOC);
$rows = $query->fetchAll(PDO::FETCH_ASSOC);
$query->execute();
$row=$query->fetch();
echo" <tr>
<td><input type = 'checkbox' name='remove[]' value='<?php echo $product_id?>'/> </td>
<td>".$row['product_name']." <br><img src='admin/product_images/".$row['product_image']."' width='80' height='80'/></td>
<td><input type='text' name='qty' value='".$row['qty']."'/></td>
<td>".$row['product_price']."</td>
</tr>
";
endwhile;
?>