I'm getting various errors (syntax) on the following php file. The current php file is about onlineshops product-to-cart adding function. I get various errors. The errors start from the first echo
and are listed as syntax error, unexpected 'echo'
.
If I remove it, I get a syntax error, unexpected ';'
on the next line.
Any help will be great. Thanks.
/* display cart */
if ( isset( $_SESSION['cart'] ) )
(
echo "<table border=0 cellspacing=0 cellpadding=0 width='500'>";
$total = 0;
foreach($_SESSION['cart'] as $id => $x)
(
$result = mysql_query("SELECT * from onlineshop WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
$name = $myrow['name'];
$name = substr($name,0,40);
$price = $myrow['price'];
$line_cost = $price * $x;
$total = $total + $line_cost;
echo "<tr>";
echo "<td allign='left'> $name </td>";
echo "<td align = 'right'>X $x <a href='cart.php?id=".$id."&action=remove'> reduce </a></td>";
echo "<td align = 'right'>= $line_cost £";
echo "</tr>";
)
echo "<tr>";
echo "<td align ='right'><br>Total=</td>";
echo "<td align ='right'><b><br> $total £</b></td>";
echo "</tr>";
echo "</table>";
)
else
echo "Cart is empty";