Display only latest three results from PHP and MySQL

Posted by nogggin1 on Stack Overflow See other posts from Stack Overflow or by nogggin1
Published on 2011-01-08T08:44:15Z Indexed on 2011/01/08 8:53 UTC
Read the original article Hit count: 192

Filed under:
|
|
|
|
<?php
$result = @mysql_query('SELECT Article
FROM news
WHERE ID = (SELECT MAX(ID) FROM News)');
if (!$result) {
die('<p>Error performing query: ' . mysql_error() .
'</p>');
}
while ( $row = mysql_fetch_array($result) ) {
echo('<p>' . $row['Article'] . '</p>');
}
?>

basically i need to tweak this so that it shows the latest 3 results instead of just the latest one, also i need the order to be:

newest 2nd newest 3rd newest

any help would be greatly appreciated!

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql