Pls Help
Posted: Mon Apr 30, 2007 10:26 am
I'm using news script for my site.I found this script.but when I put headline to home page the whole mysql result will be show as headline. but I want only latest 5 headlines.pls help me....
Code: Select all
<?php
// load the configuration file.
include("config.php");
//load all news from the database and then OREDER them by newsid
//you will notice that newlly added news will appeare first.
//also you can OREDER by (dtime) instaed of (news id)
$result = mysql_query("SELECT * FROM news ORDER BY newsid DESC",$connect);
//lets make a loop and get all news from the database
while($myrow = mysql_fetch_array($result))
{//begin of loop
//now print the results:
echo "<b>Title: ";
echo $myrow['title'];
echo "</b><br>On: <i>";
echo $myrow['dtime'];
echo "</i><hr align=left width=160>";
echo $myrow['text1'];
// Now print the options to (Read,Edit & Delete the news)
echo "<br><a href=\"read_more.php?newsid=$myrow[newsid]\">Read More...</a>
|| <a href=\"edit_news.php?newsid=$myrow[newsid]\">Edit</a>
|| <a href=\"delete_news.php?newsid=$myrow[newsid]\">Delete</a><br><hr>";
}//end of loop
?>
<!-- here you have the right to go Home or Add News. It's HTML not PHP -->
<br><br>
<a href=index.php>Home</a> <a href=add_news.php>Add News</a>