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 April 24th, 2003, 09:53 AM
NYColt NYColt is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 NYColt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Parse error: parse error, unexpected $ in

I am working with the shopping cart tutorial at: URL

And when I use the code that is posted in this article and test on my server I get this error:

Parse error: parse error, unexpected $ in /www/d/dhenders/htdocs/products.php on line 60

Line 60 is below the last line of code on the page. Her is the code that produces the message:

<?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))
{

?>

<table>
<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>

Any insight as to what could be causing this would be great!

Thanks
NYColt

Reply With Quote
  #2  
Old April 24th, 2003, 11:57 AM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
i don't see it !!

Reply With Quote
  #3  
Old April 24th, 2003, 12:06 PM
NYColt NYColt is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 NYColt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Sorry, what do you mean you don't see it?
Do you mean you do not see where an error would occur?

Reply With Quote
  #4  
Old April 24th, 2003, 12:07 PM
stfu stfu is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 19 stfu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i don't see where you close this braket:
PHP Code:
<?php
while($row mysql_fetch_array($result))
{


i think that is the problem

Last edited by stfu : April 24th, 2003 at 12:09 PM.

Reply With Quote
  #5  
Old April 24th, 2003, 12:14 PM
NYColt NYColt is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 4 NYColt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Can I try just eliminating the open bracket? And if I do I need a ; after while($row = mysql_fetch_array($result))

Reply With Quote
  #6  
Old April 24th, 2003, 12:30 PM
stfu stfu is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 19 stfu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
you can try this:
PHP Code:
<?php
while($row mysql_fetch_array($result)) {
list(
$item1$item2$item3) = $row;
echo 
"<table>\n<tr>\n<td width=\"30%\" height=\"25\">\n<font face=\"verdana\" size=\"1\" color=\"black\">$item1</font>\n</td>\n</tr>\n</table>";
};
?>

Last edited by stfu : April 24th, 2003 at 12:35 PM.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Parse error: parse error, unexpected $ in


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 5 hosted by Hostway