Jump to content

Louffeman

Members
  • Posts

    31
  • Joined

  • Last visited

Louffeman's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I found out the solution, in fact, it's very simple, like this:<td><?php print($produit['quantity']*$produit['price'])?></td>thank you so much!
  2. I will return tomorrow, it is very night here,thank you very much !
  3. for the script the output is:http://www.hostingpics.net/viewer.php?id=678861php6.jpgso, I think $_SESSION['paniers']is no good
  4. for the script: the output is:http://www.hostingpics.net/viewer.php?id=203614php5.jpg
  5. it is the same after having removed the cookies
  6. how can I delete the cookies ?I have never done it
  7. can you tell me what do it do this line ?$sql=substr($sql, 0, -1).") ORDER BY name ASC";
  8. it is the output,http://www.hostingpics.net/viewer.php?id=491451php4.jpg
  9. now the output is:SELECT * FROM trybase WHERE name IN ('',SELECT * FROM trybase WHERE name IN ('','produits',error the same:Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:wampserver32wwwsalevotre_panier.php on line 31
  10. thers' no output:if(isset($_SESSION['cart'])){$sql="SELECT * FROM trybase WHERE name IN (";$sql.=$id.",";foreach($_SESSION['cart'] as $name=>$value) {$sql.="'".$name."',";}the output is http://www.hostingpics.net/viewer.php?id=617578php3.jpgif(isset($_SESSION['paniers'])){$sql="SELECT * FROM trybase WHERE name IN (";$sql.=$id.",";foreach($_SESSION['paniers'] as $name=>$value) {$sql.="'".$name."',";
  11. I have already changed<?phpsession_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><?phpprint_r($_SESSION);if(isset($_SESSION['paniers'])){$sql="SELECT * FROM trybase WHERE name IN (";foreach($_SESSION['paniers'] as $id =>$value) {$sql.=$id.",";}$sql=substr($sql, 0, -1).") ORDER BY name ASC";$query=mysql_query($sql);while ($produit=mysql_fetch_array($query)){?><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 } ?><?php } ?><?php } ?></table><p><a href="index.php">Home[/url]</p>
  12. but I saw the tutorial is:if(isset($_SESSION['cart'])){
  13. so, now, the error is in the line 29:hile ($produit=mysql_fetch_array($query)){http://www.hostingpics.net/viewer.php?id=178851php2.jpg
  14. yes, this is the panier.php<?phpclass Panier{public $nom;private static $nbPanier = 0;public function __construct($nom){$this->name = $nom;}public function set ($key, $value){$_SESSION['paniers'][$this->nom][$key] = $value;}public function get($key){if(isset($_SESSION['paniers'][$this->nom][$key]))return $_SESSION['paniers'][$this->nom][$key];return null;}public function delet($key){if(isset($_SESSION['paniers'][$this->nom][$key]))unset($_SESSION['paniers'][$this->nom][$key]);}public function getPanier(){if(isset($_SESSION['paniers'][$this->nom]))return $_SESSION['paniers'][$this->nom];return array();}public function clear(){if(isset($_SESSION['paniers'][$this->nom]))unset($_SESSION['paniers'][$this->nom]);}}?>
×
×
  • Create New...