Click to See Complete Forum and Search --> : Retrieve entries from db then display in different tables


porsche21
02-22-2008, 07:45 AM
In my database table intranet_request I have different request entries...I want to create some code that retrieves the last 3 requests and put those request in different html tables on that page. Does this make any sense? If so how do I go about this.

This is how I would like it to be displayed
<table>
<tr>
<td> REQUEST 1</td>
<td> REQUEST 2</td>
</tr>
</table>

<table>
<tr>
<td>REQUEST 3</td>
</tr>
</table>

FrostBite
02-22-2008, 08:14 AM
Are you using MySQL? If you are you're going to want to look up "order" and "limit" keywords in your select statement. Hope this helps.
-Frosty

euqrop
02-22-2008, 08:14 AM
How about count the records and then select from x to x ???

raistlin
02-22-2008, 08:59 AM
Try this :P

<table>
<tr>
<?php
$numberYouLike = 1;
$request = 'contain the result of your db request in mysql_fetch_array';

for($i=0;$i<=$numberYouLike;$i++)
{
echo "<td> {$request[$i]}</td>";
}
?>
</tr>
</table>

<table>
<tr>
<?php echo "<td>{$request[2]}</td>"; ?>
</tr>
</table>