PDA

View Full Version : Little coding quetion



:Lively
11-06-2007, 03:36 PM
How do I get it to just display the latest article in the below script:-


<?php
require('connect.php');
require('functions.php');
?>
<LINK href="/default.css" rel="stylesheet" type="text/css">
<center><b><u>Radio News</b></u></center><p>

<?php
$result = mysql_query("SELECT poster, ip, date, title, article FROM rp_news ORDER BY id DESC");
while($row = mysql_fetch_assoc($result)){
echo "<font color='black'><b>Title:</b></font> ".$row['title']."<br/>
<font color='black'><b>Posted By:</b></font> DJ ".$row['poster']."<p>
<font color='black'><b>Article:</b></font> ".$row['article']."<br/>
<p><div align='center'><hr width='70%'></div><p>";
}
?>

<?php require('bottom.php');?>

Drompo
11-06-2007, 03:50 PM
<?php
require('connect.php');
require('functions.php');
?>
<LINK href="/default.css" rel="stylesheet" type="text/css">
<center><b><u>Radio News</b></u></center><p>

<?php
$result = mysql_query("SELECT poster, ip, date, title, article FROM rp_news ORDER BY id DESC LIMIT 1");
while($row = mysql_fetch_assoc($result)){
echo "<font color='black'><b>Title:</b></font> ".$row['title']."<br/>
<font color='black'><b>Posted By:</b></font> DJ ".$row['poster']."<p>
<font color='black'><b>Article:</b></font> ".$row['article']."<br/>
<p><div align='center'><hr width='70%'></div><p>";
}
?>

<?php require('bottom.php');?>

Limit 1 in your query

Have Fun

:Lively
11-06-2007, 03:59 PM
Ty Mate!

Want to hide these adverts? Register an account for free!