I am trying hard to learn how to create this shop cart using php and seems to me that I got stuck once more. This time I just can not make the "additional conditioning to amount available in stock" to work well. Can anybody help me to figure out what is wrong with my php code below?
if (isset($_GET['add'])) {
$con = mysqli_connect("localhost", "noivaemd_etalhes", "password", "***") or die (mysqli_error());
$quantity = mysqli_query($con, "SELECT id, quantity FROM Products WHERE id=".mysqli_real_escape_string($con, $_GET['add']));
echo '<p>'.$quantity_row['quantity'];
while($quantity_row = mysqli_fletch_assoc ($quantity)) {
if ($quantity_row['quantity']!=$_SESSION['cart_'.$_GET['add']]) {
$_SESSION['cart_'.$_GET['add']]+='1';
}
}
}