Cant get my code to work? Can someone please help.
Posted: Sat Sep 26, 2009 8:40 am
This code is for a online shop to display all products in a database, iv doen it before but lost the code so iv had to do it again, i just can not remember how i did it. The image, description and price will not show? The url and description and price are all in a mysql database. Would be ace if someone helped me out.
thanks
Code: Select all
<?php
mysql_connect("localhost", "********", "******") or die(mysql_error());
mysql_select_db("buttons1_chipboard") or die(mysql_error());
$query = "SELECT * FROM chipboard";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo " <table> \n";
echo " <tr>\n";
echo " <td>\n";
echo " <img src=\"$row ['img']\" width=\"350px\" />\n";
echo " <br />\n";
echo " $row ['desc']\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " <table>\n";
echo " <tr>\n";
echo " <td>\n";
echo " $row ['price']\n";
echo " </td>\n";
echo " <td>\n";
echo " buy now.\n";
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo " \n";
}
?>
thanks