I have been having a parse error on line 8. This is a online shopping (cart) system.
Parse error: parse error in C:\wamp\www\pin project\cart.php on line 8
I am having problems to slove this and need some help.
Code: Select all
session_start();
$page = 'index.php';
mysql_connect('localhost','root','')or die (mysql_error('unable to connect to the database'));
mysql_select_db('cart')or die(mysql_error('error with the table'));
if (isset($_GET['add'])){
$_SESSION['cart_'.$_GET['add']]+='1';
$quantity = mysql_query('SELECT id, quantity FROM products WHERE id'= mysql_real_escape_string($_GET['add']));
while($quantity_row = mysql_fetch_assoc($quantity)){
if ($quantity_row['quantity']!=$_SESSION['cart_'.$_GET['add']]){
$_SESSION['cart_'.$_GET['add']]+='1';
echo $_SESSION['cart_'];
}
}
}
function products (){
$get = mysql_query('SELECT id,name,description,price FROM products WHERE quantity>0 ORDER BY id DESC');
if (mysql_num_rows($get)==0){
echo " there are no items to be dispalyed.";
}
else {
while ($get_row = mysql_fetch_assoc($get)){
echo '<p>'.$get_row['name'].'<br/>'.$get_row['description'].'<br/>'.$get_row['price'].'<a href="cart.php?add='.$get_row['id'].'">Add</a></p>';
}
}
}
echo $_SESSION['cart_1'];
regards
shehan31