-
January 28th, 2012, 01:50 PM
#1
I have a problem with mysql database!
Hi I'm making shopping cart and i have a problem displaying the products from the database. The language is PHP and here's a part of the code where I think the problem is? Can you help me? thanks
Code:
<table border="0" cellpadding="2px" width="600px">
<?
$result=mysql_query("select * from products");
while($row=mysql_fetch_array($result)){
?>
<tr>
<td><img src="<?php=$row['picture']?>" /></td>
<td> <b><?php=$row['name']?></b><br />
<?php=$row['description']?><br />
Price:<big style="color:green">
$<?php=$row['price']?></big><br /><br />
<input type="button" value="Add to Cart" onclick="window.location='shoppingcart.php'" />
</td>
</tr>
<tr><td colspan="2"><hr size="1" /></td>
<? } ?>
</table>
-
January 30th, 2012, 12:15 AM
#2
Re: I have a problem with mysql database!
Two problems right off.
1. You should always use the full <?php tag opening. Not all servers have short tags enabled.
2. You're not using echo. You're simply using =$row....
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|