This question already has an answer here:
I'm creating a shopping cart systems and I'm getting this error when trying to add the item to the cart.
<?php
session_start();
require('inc/connect.php');
if(isset($_GET['action']) && $_GET['action']=="add") {
$id=intval($_GET['id']);
if(isset($_SESSION['cart'][$id])) {
$_SESSION['cart'][$id]['quantity']++;
}
else {
$sql_s ="SELECT * FROM product WHERE product_id = ['id']";
$query_s=mysql_query($sql_s);
if(mysql_num_rows($query_s) !=0) {
$row_s=mysql_fetch_array($query_s);
$_SESSION['cart'][$row_s['product_id']]==array(
"quantity" => 1,
"price" => $row_s['price']);
}
else {
$message="This product id is invalid!";
}
}
}
?>
My error is saying line 16 which is:
$query_s=mysql_query($sql_s);
</div>