Page 1 of 1
displaying news heading from mysql database
Posted: Thu May 11, 2006 2:11 am
by magreth
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
Posted: Thu May 11, 2006 2:38 am
by Maugrim_The_Reaper
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

Posted: Thu May 11, 2006 4:51 am
by dibyendrah
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
?>