Extracting data in pre made html tables {HELP NEWBIE}
Posted: Tue Jan 17, 2006 9:02 am
Please help i'm still a newbie at PHP
Details
I want to extract the last 4 entries into these premade 4 boxes as shown below. This will be shown on a page so whenever i upload a new item it will automatically update the last 4 entires into these boxes.
What i need is to extract the image which will be shown in the top half of the box and bottom will be the title and these will be hyperlinked to the a specific page.
The Problem
I haven't started with the image extraction but the title to start off with and im guessing once i have the title working correctly the image will follow the
same route.
Well i have managed to display the last uploaded item to display but it repeats the same title in the extra three boxes which instead it should display the next 3 entry titles.
The problem picture

I undertand my PHP isnt written correctly but a helping hand is all i need as i find this all very difficult especially writing it all up and understanding.
Coulde anyone help?
PHP Script
Details
I want to extract the last 4 entries into these premade 4 boxes as shown below. This will be shown on a page so whenever i upload a new item it will automatically update the last 4 entires into these boxes.
What i need is to extract the image which will be shown in the top half of the box and bottom will be the title and these will be hyperlinked to the a specific page.
The Problem
I haven't started with the image extraction but the title to start off with and im guessing once i have the title working correctly the image will follow the
same route.
Well i have managed to display the last uploaded item to display but it repeats the same title in the extra three boxes which instead it should display the next 3 entry titles.
The problem picture

I undertand my PHP isnt written correctly but a helping hand is all i need as i find this all very difficult especially writing it all up and understanding.
Coulde anyone help?
PHP Script
Code: Select all
<?php
include('db_connect.inc')
?>
<?php
mysql_select_db("Shop");
$query = "SELECT * FROM Shop " .
"ORDER BY POSTDATE DESC " ;
$results = mysql_query($query)
or die(mysql_error());
$row = mysql_fetch_array($results);
extract($row);
?>
<table width="360" align="center">
<tr>
<td><table width="360" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/latest.gif" width="360" height="30"></td>
</tr>
<tr>
<td><img src="images/contentspacer.gif" width="2" height="14"></td>
</tr>
<tr>
<td><table width="174" cellpadding="0" cellspacing="0">
<tr>
<td width="46%" valign="top" bgcolor="eaeaea"><table width="100%" cellspacing="4">
<tr id="latest01">
<td height="165" valign="top"><img src="images/shirt.jpg" width="163" height="165"></td>
</tr>
<tr>
<td bgcolor="a9a9a9"><table width="100%" cellspacing="0" cellpadding="4">
<tr>
<td><?php echo $row[3] ?></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="8%"><img src="images/contentspacer.gif" width="7" height="14"></td>
<td width="46%" bgcolor="eaeaea"><table width="100%" cellspacing="4">
<tr>
<td><img src="images/shirt.jpg" width="163" height="165"></td>
</tr>
<tr>
<td bgcolor="a9a9a9"><table width="100%" cellspacing="0" cellpadding="4">
<tr>
<td><?php echo $row[3]; ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/contentspacer.gif" width="2" height="14"></td>
</tr>
<tr>
<td><table width="174" cellpadding="0" cellspacing="0">
<tr>
<td width="46%" bgcolor="eaeaea"><table width="174" cellspacing="4">
<tr>
<td><img src="images/shirt.jpg" width="163" height="165"></td>
</tr>
<tr>
<td bgcolor="a9a9a9"><table width="100%" cellspacing="0" cellpadding="4">
<tr>
<td><?php echo $row[3]; ?></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="8%"><img src="images/contentspacer.gif" width="7" height="14"></td>
<td width="46%" bgcolor="eaeaea"><table width="100%" cellspacing="4">
<tr>
<td><img src="images/shirt.jpg" width="163" height="165"></td>
</tr>
<tr>
<td bgcolor="a9a9a9"><table width="100%" cellspacing="0" cellpadding="4">
<tr>
<td><?php echo $row[3]; ?></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><img src="images/contentspacer.gif" width="2" height="14"></td>
</tr>
</table>