hi
im looking for a way i can display news heading from database and when a user click the link heading will be directed to the news page
thanx in advance
displaying news heading from mysql database
Moderator: General Moderators
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
On a page you presumably could grab all newsheadlines (sorted by date, and only a certain number using LIMIT), list them on a page, use each to create a link holding the full articles row id, then have the second page grab the entire news article and display it...
You can post any code you have if you require more assistance
You can post any code you have if you require more assistance
- dibyendrah
- Forum Contributor
- Posts: 491
- Joined: Wed Oct 19, 2005 5:14 am
- Location: Nepal
- Contact:
Here's the code sample :
Code: Select all
<?php
$i=1;
$sql_fetch_news="select * from news order by date desc limit 0,10";
$rs_fetch_news=mysql_query($sql_fetch_news)or die(mysql_error());
while($news=mysql_fetch_assoc($rs_fetch_news))
{
?>
<tr>
<td align=left valign="top" height="13">
<?=$i?>
. <a href="news_details.php?id=<?=$news["news_id"]?>">
<?=$news["news_headline"]?>
</a> (
<?=$news["news_date"]?>
) </td>
</tr>
<?php
$i++;
}//end while
?>