Jump to content

Only show "x" results


whare

Recommended Posts

Hi All Me again :)

right im trying to work out how to show only the newest entries into the sql db basicly like a preview of what has happend latly but i have no idea how to do (I no I need to get a php book lol well I got one on order lol)

so can anybody tell me how or point me towards something that tells me how

Thanx

Whare

[sorry no code to show you what i got not started working on it yet]
Link to comment
Share on other sites

Instead of:
[code]
while($row=mysql_fetch_row($result))
{
//Some code
}
[/code]
Use:
[code]
$shown=0;
$toshow=12;
while($row=mysql_fetch_row($result))
{
if($show<=$toshow)
{
//Some code
}
}
[/code]


To show the most RECENT mysql rows, put desc after the ORDER BY id bit. (ORDER BY id desc)

EDIT: You can change $toshow=12 to $toshow=the number of rows you want to show.
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.