I'm learning PHP and doing a basic eCommerce shopping cart for practice. I came across an issue that's stumped me. I made an array to display the current amount of a single item the shopper has in their cart, but rather than displaying the value it displays "array."
Below is what I'm using:
<?php
if(isset($_SESSION['Cart'])){
$sql="SELECT * FROM products where Product_ID IN (";
foreach($_SESSION['Cart'] as $id => $value){
$sql.=$id.",";
}
$sql=substr($sql, 0, -1).") ORDER BY Category ASC";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>
<p><?php echo $row['Name']?> x <?php echo $_SESSION['Cart'][$row['Product_ID']['quantity']] ?></p>
<?php
}
}else{
echo "<p>There are no products selected</p>";
}
?>
I'm not sure if that's where the exact issue is though. The rest of my site is sourced here(Index) and here(Product page) if anyone would be so kind as to troubleshoot with me.