Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php mysql how do i jump to a specific row?

Status
Not open for further replies.

ksoong

Programmer
Oct 3, 2000
57
0
0
CA
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)

how do i do this?
thanks in advance
 
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(&quot;dbname&quot;,&quot;select * from newstable order by date desc&quot;);
for($i=0;$i<3;$i++)
{
$newstitle=mysql_result($getallnews,$i,&quot;title&quot;);
$newsbody=mysql_result($getallnews,$i,&quot;body&quot;);
echo &quot;
<H3>$newstitle</H3>
<BR>$newsbody<P>
&quot;;
}
?>
</BODY>
</HTML>

If this confuses you, feel free to ask.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top