Jump to content

Louffeman

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Louffeman

  1. I have already solved the problem, thanks a lot
  2. I have corrected my script ajout_panier.phpnow, it is OK, but the last script(votre_script) still has problem in the line 7:Undefined variable: listproduit in C:wampserver32wwwsalevotre_panier.php on line 7the line 7 is: <?php if(!$listproduit){?>the output is the cart is empty, which mean's it didn't receive anything ?it is votre_script.php<?phpsession_start();require_once 'panier.php';$panier = new Panier('produits');?><?php if(!$listproduit){?><p> The cart is empty </p><?php } else {?><table border="1" width="50%"><tr><td>Name</td><td>Price</td><td>Quantity</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</a></p>
  3. @Ingolmethe server has no any error indicate before the line 5
  4. yes, as you see:$mysql = new mysqli('localhost', 'root', '', 'testebase');
  5. @JamesBthank you for your reply, I did as you said,but now, the error is in the line 5: $mysql = new mysqli('localhost', 'root', '', 'testebase');Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in C:wampserver32wwwsalepanier.php on line 5
  6. Hi,I have a problem of my shopping cart script,my server indicate the error in this line: $produit = $result->fetch_assoc();error: Fatal error: Call to a member function fetch_assoc() on a non-object in C:wampserver32wwwsaleajout_panier.php on line 7je d'ont know how to solve it,anyone can help me please ?<?phpsession_start();$mysql = new mysqli('localhost', 'root', '', 'testebase');$result = $mysql->query('SELECT * FROM trybase WHERE name= '.$_POST['name']);$produit = $result->fetch_assoc();require_once 'panier.php';$valeur = array('name'=>$produit['name'],'price'=>$produit['price'],'quantity'=>$_POST['quantity']);$panier->set($_POST['name'], $valeur);header('location: votre_panier.php');?>
×
×
  • Create New...