I need to know how to jump to specific rows, in my mysql database using PHP. i have a huge index of news entries but i want to output only certain entries. (i.e. the last three entries in the database)
Here's an example, hopefully you know enough PHP/MySQL to fit this to your personal needs:
<HTML>
<HEAD>
<TITLE>News Page</TITLE>
</HEAD>
<BODY>
<?PHP
$getallnews=mysql("dbname","select * from newstable order by date desc"
for($i=0;$i<3;$i++)
{
$newstitle=mysql_result($getallnews,$i,"title"
$newsbody=mysql_result($getallnews,$i,"body"
echo "
<H3>$newstitle</H3>
<BR>$newsbody<P>
";
}
?>
</BODY>
</HTML>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.