JamesB Posted August 18, 2014 Share Posted August 18, 2014 Okay, check my previous post though I posted another update. And dont forget to update this one from 'cart' to 'paniers' <td><?php print $_SESSION['cart'][$produit['name']]*$produit['quantity'];?>€</td> Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 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."',"; Link to comment Share on other sites More sharing options...
JamesB Posted August 18, 2014 Share Posted August 18, 2014 Remove this line: $sql.=$id.","; Then add: echo $sql; after your foreach loop. You will need to reset your cookies and run the page again which stores data into the session. Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 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 Link to comment Share on other sites More sharing options...
JamesB Posted August 18, 2014 Share Posted August 18, 2014 What's the latest code you have? Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 it is the output,http://www.hostingpics.net/viewer.php?id=491451php4.jpg Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 can you tell me what do it do this line ?$sql=substr($sql, 0, -1).") ORDER BY name ASC"; Link to comment Share on other sites More sharing options...
JamesB Posted August 18, 2014 Share Posted August 18, 2014 That line looks fine. What is your latest code? And did you delete your cookies? Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 how can I delete the cookies ?I have never done it Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 ok, I removed all the cookies Link to comment Share on other sites More sharing options...
JamesB Posted August 18, 2014 Share Posted August 18, 2014 https://www.google.co.uk/?gws_rd=ssl#q=how+to+delete+cookies Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 it is the same after having removed the cookies Link to comment Share on other sites More sharing options...
JamesB Posted August 18, 2014 Share Posted August 18, 2014 Okay, but can you please post your latest code? Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 for the script: <?phpif(isset($_SESSION['cart'])){$sql="SELECT * FROM trybase WHERE name IN (";foreach($_SESSION['cart'] as $name=>$value) {$sql.="'".$name."',";}$sql=substr($sql, 0, -1).") ORDER BY name ASC";$query=mysql_query($sql);while ($produit=mysql_fetch_array($query)){?>the output is:http://www.hostingpics.net/viewer.php?id=203614php5.jpg Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 for the script <?phpif(isset($_SESSION['paniers'])){$sql="SELECT * FROM trybase WHERE name IN (";foreach($_SESSION['paniers'] as $name=>$value) {$sql.="'".$name."',";}$sql=substr($sql, 0, -1).") ORDER BY name ASC";$query=mysql_query($sql);while ($produit=mysql_fetch_array($query)){?>the output is:http://www.hostingpics.net/viewer.php?id=678861php6.jpgso, I think $_SESSION['paniers']is no good Link to comment Share on other sites More sharing options...
Louffeman Posted August 18, 2014 Author Share Posted August 18, 2014 I will return tomorrow, it is very night here,thank you very much ! Link to comment Share on other sites More sharing options...
Louffeman Posted August 19, 2014 Author Share Posted August 19, 2014 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! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now