Hi,
I have a shopping cart (first script)below is OK, but when I want to make the calculate(second script) the amount,
it indicate the under last line ( <p><a href="index.php">Home[/url]</p), error is: Parse error: syntax error, unexpected $end in C:\wampserver32\www\sale\votre_panier.php on line 41
I wish someone can help me to modifiy it.
first script (it is OK)
<?php
session_start();
require_once 'panier.php';
$panier = new Panier('produits');
$listproduit = $panier->getPanier();
?>
<?php if(!$listproduit){?>
<p> votre panier est vide </p>
<?php } else {?>
<table border="1" width="50%">
<tr>
<td>Name</td>
<td>Price</td>
<td>Quantity</td>
<td>Amount</td>
</tr>
<?php foreach($listproduit as $produit) { ?>
<tr>
<td><?php print $produit['name'] ?></td>
<td><?php print $produit['price'] ?></td>
<td><?php print $produit['quantity'] ?></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<p><a href="index.php">Home[/url]</p>
second script:
session_start();
require_once 'panier.php';
$panier = new Panier('produits');
$listproduit = $panier->getPanier();
?>
<?php if(!$listproduit){?>
<p> votre panier est vide </p>
<?php } else {?>
<table border="1" width="50%">
<tr>
<td>Name</td>
<td>Price</td>
<td>Quantity</td>
<td>Amount</td>
</tr>
<?php
if(isset($_SESSION['cart'])){
$sql="SELECT * FROM trybase WHERE name IN (";
foreach($_SESSION['cart'] as $id =>$value) {
$sql.=$id.",";
}
$sql=substr($sql, 0, -1).") ORDER BY name ASC";
$query=mysql_query($sql);
while ($produit=mysql_fetch_array($query)){
?>
<?php foreach($listproduit as $produit) { ?>
<tr>
<td><?php print $produit['name'] ?></td>
<td><?php print $produit['price'] ?></td>
<td><?php print $produit['quantity'] ?></td>
<td><?php print $_SESSION['cart'][$produit['name']]*$produit['quantity']?>€</td>
</tr>
<?php } ?>
</table>
<?php } ?>
<p><a href="index.php">Accueil[/url]</p>