Php Mysql Shopping Cart

Reply

Join Date: Dec 2006
Posts: 25
Reputation: wandie is an unknown quantity at this point 
Solved Threads: 0
wandie wandie is offline Offline
Light Poster

Php Mysql Shopping Cart

 
0
  #1
Mar 13th, 2008
Could some please help me. I am following a tutorial from "http://www.devarticles.com/c/a/MySQL/Building-A-Persistent-Shopping-Cart-With-PHP-and-MySQL/2/"

I keep getting a "
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\cart1\products.php on line 59"

My db connection is fine but I am trying bring a result from the diagram shown in the url. Please help. This is what I have put in my code from the site the products page.

  1. <?php
  2.  
  3. // This page will list all of the items
  4. // from the items table. Each item will have
  5. // a link to add it to the cart
  6.  
  7. include("db.php");
  8.  
  9. // Get a connection to the database
  10. $cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
  11. $result = mysql_query("select * from items order by itemName asc");
  12.  
  13. ?>
  14. <?php
  15. while($row = mysql_fetch_array($result))
  16. {
  17. ?>
  18. <html>
  19. <head>
  20. <title>Products</title>
  21. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  22. </head>
  23.  
  24. <body>
  25. <table>
  26. <tr>
  27. <td width="30%" height="25">
  28. <font face="verdana" size="1" color="black">
  29. <?php echo $row["itemName"]; ?>
  30. </font>
  31. </td>
  32. <td width="10%" height="25"> <font face="verdana" size="1" color="black"> <?php echo $row["itemPrice"]; ?>
  33. </font> </td>
  34. <td width="50%" height="25">
  35. <font face="verdana" size="1" color="black">
  36. <?php echo $row["itemDesc"]; ?>
  37. </font>
  38. </td>
  39. <td width="10%" height="25">
  40. <font face="verdana" size="1" color="black">
  41. <a href="cart.php?action=add_item&id=<?php echo $row["itemId"]; ?>&qty=1">Add Item</a>
  42. </font>
  43. </td>
  44. </tr>
  45. <tr>
  46. <td width="100%" colspan="4">
  47. <hr size="1" color="red" NOSHADE>
  48. </td>
  49. </tr>
  50. <tr>
  51. <td width="100%" colspan="4">
  52. <font face="verdana" size="1" color="black">
  53. <a href="cart.php">Your Shopping Cart &gt;&gt;</a>
  54. </font>
  55. </td>
  56. </tr>
  57. </table>
  58. </body>
  59. </html>
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 121
Reputation: Auzzie is an unknown quantity at this point 
Solved Threads: 16
Auzzie Auzzie is offline Offline
Junior Poster

Re: Php Mysql Shopping Cart

 
0
  #2
Mar 13th, 2008
If that is all the code from the page it is because you forgot the closing curley brace } for the while loop
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 25
Reputation: wandie is an unknown quantity at this point 
Solved Threads: 0
wandie wandie is offline Offline
Light Poster

Re: Php Mysql Shopping Cart

 
0
  #3
Mar 13th, 2008
Originally Posted by Auzzie View Post
If that is all the code from the page it is because you forgot the closing curley brace } for the while loop

Thanks would anyone know where i can get info on how to display information from a database or retrieve info for my items and display them on the page
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 121
Reputation: Auzzie is an unknown quantity at this point 
Solved Threads: 16
Auzzie Auzzie is offline Offline
Junior Poster

Re: Php Mysql Shopping Cart

 
0
  #4
Mar 13th, 2008
It depends on which database your using (mysql, mssql etc) www.php.net and search mysql
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 25
Reputation: wandie is an unknown quantity at this point 
Solved Threads: 0
wandie wandie is offline Offline
Light Poster

Re: Php Mysql Shopping Cart

 
0
  #5
Mar 14th, 2008
Mysql I am trying to display the info just like the one on the url i sent "http://www.devarticles.com/c/a/MySQL/Building-A-Persistent-Shopping-Cart-With-PHP-and-MySQL/2/"

the results should be at the bottom
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 121
Reputation: Auzzie is an unknown quantity at this point 
Solved Threads: 16
Auzzie Auzzie is offline Offline
Junior Poster

Re: Php Mysql Shopping Cart

 
0
  #6
Mar 14th, 2008
Well have a look on php.net as there are alot of user submitted examples and walkthroughs that will be able to help you
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC