Jump to content

Recommended Posts

Hi I need some help, I am a huge newbie to PHP so please dont talk to technical. Basically im building a joomla site anyway I dont how to show the latest 5 records (basically the text submitted in text boxes on a page) I want to show the 5 most ecent entriesthe same page just beneath the text boxes. How do I do this and which variables/tags do I need to use? Thanks.
Link to comment
https://forums.phpfreaks.com/topic/12043-showing-newest-records/
Share on other sites

I'm assuming these entries are from a db? probably an sql db? what kind of page is this, are these items listed elsewhere? is this stuff already logged by the site? Be a bit more specific about it.

In any case if they're from the db you need to know the fields, and the id field which I assume it has

$sql = "SELECT * FROM `table` ORDER BY `id` DESC LIMIT 5";
$result = mysql_query ($sql) or die (mysql_error ());
while ($data = mysql_fetch_array ($result))
{
?><tr><td><?=$data['text']?></td> etc.... <?
}
Link to comment
https://forums.phpfreaks.com/topic/12043-showing-newest-records/#findComment-45821
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.