I have a wierd problem with a for loop.
I have articles in my db, nothing wierd about that.
I have on a index page last 5 articles... it displays 1!
When I copy the code and insert it to an empty .php3 document and run it, it displays 5. Like it should.
This is the code...
<?
$foo = mysql_query("Select * from articles order by date DESC limit 5");
for ($i == o; $i < mysql_num_rows($foo); $i++) {
$artikel = mysql_fetch_array($foo);
echo $artikel[title];
}
?>
See, it should only display last 5 entries sorted by the date.
And it does, when it's alone in it's own document.
In the index page a similar loop is above it, for the last 10 news entries.
I've gone over the code over and over again, but no luck... can someone see why?
I have articles in my db, nothing wierd about that.
I have on a index page last 5 articles... it displays 1!
When I copy the code and insert it to an empty .php3 document and run it, it displays 5. Like it should.
This is the code...
<?
$foo = mysql_query("Select * from articles order by date DESC limit 5");
for ($i == o; $i < mysql_num_rows($foo); $i++) {
$artikel = mysql_fetch_array($foo);
echo $artikel[title];
}
?>
See, it should only display last 5 entries sorted by the date.
And it does, when it's alone in it's own document.
In the index page a similar loop is above it, for the last 10 news entries.
I've gone over the code over and over again, but no luck... can someone see why?