$title = ": Products"; include "lib/layout.inc.php"; if (!isset($_GET['id'])){ header("Location: shop.php"); die(); } $sql = "SELECT * FROM product WHERE id = '" . $_GET['id'] . "' LIMIT 1"; $result = mysql_query($sql) or print(mysql_error()); $row = mysql_fetch_assoc($result); $qty = 0; if (isset($_SESSION['cart']['items'])){ foreach($_SESSION['cart']['items'] as $k => $v){ if (isset($v['id']) && $v['id'] == $row['id']) $qty = $v['qty']; } } head($title, ""); body(); begin_content(); ?>