Hi - was just wondering if anyone could help a php newbie
I'm trying to read in a list of items and display them in a table
What I would like to do is have a box of text to the left and one item from db alongside it followed by rows of three items
My micky mouse code is below - any help much appreciated
<?
include("conf/config.inc.php");
$p=$_GET['p'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM `products` where `cat_id` = $p";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
?>
<table border='0'>
<tr>
<TD colspan="2" class="border" valign="top" width="390">
<div class="sectitle">Large Shades</div>
<div class="txt">
The Large Shade looks great as a pendant or you can <BR>
team it with a large base to create a stunning table lamp.<BR><BR>
<b>Shade</b>: £00.00<BR>
<b>Shade with ceramic base</b>: £00.00<BR><BR>
Dimensions<BR>
<b>Shade</b>: height 20cm, diam 31cm<BR>
<b>Base</b>: height 50cm<BR>
(Shade and base combined: height 70cm)<BR><BR>
<b>Bulb</b>: 60W Max<BR><BR>
All products are great
<?php
$i=0;
while ($i < $num) {
$name=mysql_result($result,$i,"name");
$description=mysql_result($result,$i,"description");
$price=mysql_result($result,$i,"price");
$sm_image=mysql_result($result,$i,"sm_image_url");
$lg_image=mysql_result($result,$i,"lg_image_url");
?>
<td><?php echo $name; ?> <br /> <img src=<?php echo $sm_image; ?>
</td>
</tr>
<?php
$i++;
}
?>
</table>