General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 25th, 2002, 03:35 PM
roberto_nl roberto_nl is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: The Netherlands
Posts: 19 roberto_nl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Problem with shopping cart

I was reading the tutorial on
Building A Persistent Shopping Cart With PHP and MySQL

i'm having a problem with products.php
it looks like this:
PHP Code:
<?php 

// This page will list all of the items 
// from the items table. Each item will have 
// a link to add it to the cart 

include("db.php"); 

// Get a connection to the database 
$cxn = @ConnectToDb($dbServer$dbUser$dbPass$dbName); 
$result mysql_query("select * from items order by itemName asc"); 
?>

<?php 
while($row mysql_fetch_array($result)) 

?> 
<tr> 
<td width="30%" height="25"> 
<font face="verdana" size="1" color="black"> 
<?php echo $row["itemName"]; ?> 
</font> 
</td> 
<td width="10%" height="25"> 
<font face="verdana" size="1" color="black"> 
$<?php echo $row["itemPrice"]; ?> 
</font> 
</td> 
<td width="50%" height="25"> 
<font face="verdana" size="1" color="black"> 
<?php echo $row["itemDesc"]; ?> 
</font> 
</td> 
<td width="10%" height="25"> 
<font face="verdana" size="1" color="black"> 
<a href="cart.php?action=add_item&id=<?php echo $row["itemId"]; ?>&qty=1">Add Item</a> 
</font> 
</td> 
</tr> 
<tr> 
<td width="100%" colspan="4"> 
<hr size="1" color="red" NOSHADE> 
</td> 
</tr> 
<tr> 
<td width="100%" colspan="4"> 
<font face="verdana" size="1" color="black"> 
<a href="cart.php">Your Shopping Cart >></a> 
</font> 
</td> 
</tr> 
</table> 
</body> 
</html>


and when i view in on the server i get :
Parse error: parse error in products.php on line 54

line 54 is the last line ( </html>)
but when i remove it, i keep getting it (line 54 is beeing replaced bij the number of last line)

i realy dont understand what the problem of the script is.
please help me !

Reply With Quote
  #2  
Old September 25th, 2002, 04:45 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
This is because you have opened with while function but not closed it

for the last lines you need something like this:

</font>
</td>
</tr>
<?php } ?>
</table>
</body>
</html>



that will stop the error

Reply With Quote
  #3  
Old September 1st, 2003, 10:19 PM
devartam3 devartam3 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 devartam3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to devartam3
Don't forget to close out loops

You forgot to close-out your while-statement loop with a "}".

while (bla bla) {
// loop thru code here
} // <--MAKE SURE YOU HAVE THIS AT THE END OF YOUR WHILE STATEMENT


Note: Most of the time you get that message, is because of this reason.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Problem with shopping cart


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT