HormonX
08-24-2002, 12:51 AM
well .. it's not that simple to me ... ok ... where it is ...
my problem is very simple .. am pulling some things from database and display them in the table. but i want only newest for example 5 items to appear. Well i did pull all the items form the database ... and that's cool, now how do i count them and stop after 5 items ?
can anyone help,
I have tried i think just about anything i could find and try.. and still could not get it right.
Please help me :) ...
Here is piece of code i have written up ...
----------------------------------------------
$query = "SELECT * FROM links ORDER BY id DESC";
$result = mysql_query( $query, $link );
while ($counter < 5)
{
while($r=mysql_fetch_array($result))
{
$cat=$r["cat"];
$url=$r["url"];
echo "<span class='body'><a href='http://$url' target='_blank'>$url</a> - $cat<br></span>";
}
$counter ++;
break;
}
--------------------------------
What am i doing wrong ?
thanks in advance :)
my problem is very simple .. am pulling some things from database and display them in the table. but i want only newest for example 5 items to appear. Well i did pull all the items form the database ... and that's cool, now how do i count them and stop after 5 items ?
can anyone help,
I have tried i think just about anything i could find and try.. and still could not get it right.
Please help me :) ...
Here is piece of code i have written up ...
----------------------------------------------
$query = "SELECT * FROM links ORDER BY id DESC";
$result = mysql_query( $query, $link );
while ($counter < 5)
{
while($r=mysql_fetch_array($result))
{
$cat=$r["cat"];
$url=$r["url"];
echo "<span class='body'><a href='http://$url' target='_blank'>$url</a> - $cat<br></span>";
}
$counter ++;
break;
}
--------------------------------
What am i doing wrong ?
thanks in advance :)