|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
hi everyone
i keep getting an error message from the code below. the error i get is Parse error: parse error in /public_html/db.php on line 55 can someone please help! <?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["title"]; ?> </font> </td> <td width="10%" height="25"> <font face="verdana" size="1" color="black"> $<?php echo $row["price"]; ?> </font> </td> <td width="50%" height="25"> <font face="verdana" size="1" color="black"> <?php echo $row["description"]; ?> </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["dvdID"]; ?>&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> THIS IS LINE 55 THANKS |
|
#2
|
||||
|
||||
|
You're not ending your while loop. After line 55, you need to add:
PHP Code:
|
|
#3
|
|||
|
|||
|
thanks for replying
i have add your suggestion but its still not working. i think that the problem is with the syntax. can some help! thanks <?php include("db.php"); $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["title"]; ?> </font> </td> <td width="10%" height="25"> <font face="verdana" size="1" color="black"> $<?php echo $row["price"]; ?> </font> </td> <td width="50%" height="25"> <font face="verdana" size="1" color="black"> <?php echo $row["description"]; ?> </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["dvdID"]; ?>&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> <?php } ?> ![]() |
|
#4
|
||||
|
||||
|
I pasted your code into a file on my server and tweaked it to account for the fact that I don't have the same database as you, and it parsed fine. Perhaps you should look at your db include or any other includes (or files that include this document).
Actually, now that I look at your initial posting, I see that it references line 55 of db.php, which the code you've given here includes. So you should actually be looking at line 55 of db.php for your error (though the change I noted above was also necessary). |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > help getting data from mysql table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|