04-29-2008, 09:59 AM
|
#2 (permalink)
|
|
The Addict
Join Date: Nov 2007
Posts: 264
Thanks: 2
|
PHP Code:
$r = 0; $sql = "SELECT * FROM news ORDER BY id DESC"; $result = mysql_query($sql); while($rows = mysql_fetch_array($result) && $r <= 3) { echo $r.'<br/>'; echo $rows['datenum']; echo'<br/>'; ++$r; }
This is probably something along the lines that you want, it'll loop while theres rows to fetch and r is less then or equal to three when one condition is met it'll stop.
(Doing this reminded me on my dependance on a database wrapper...I haven't actually used mysql_fetch_array since php4 I think)
__________________
"What everyone seems to forget is that while knowledge certainly is something - it's the implementation of knowledge that brings power" - Andres Galindo.
|
|
|
|