HunterSeeker
Newbie
- Joined
- Apr 13, 2004
- Messages
- 1,694
- Reaction score
- 0
I think this is the right forum...
Anyway I need some help witth a website I am working on, currently I am working on a news system and it is supposed to display the 3 lateest news but it only displays the absolutly latest.
Please, take a look to see if you can find the problem:
By the way, before anyone mentions it:
For loops =
Anyway I need some help witth a website I am working on, currently I am working on a news system and it is supposed to display the 3 lateest news but it only displays the absolutly latest.
Please, take a look to see if you can find the problem:
Code:
<?php
$i=0;
while($i!=3){
//Läs in rubriken
$db=mysql_connect("localhost","pierre","870430");
mysql_select_db("Pierre",$db);
$result = mysql_query("SELECT Header FROM Nyheter ORDER BY Datum DESC",$db);
$getrow = mysql_fetch_row($result);
if (strlen($getrow[$i]) >= 3)
{
echo "<h1>" . $getrow[$i]. "</h1>";
//echo $i; Debugger...
//Läst in datumet
$db=mysql_connect("localhost","pierre","870430");
mysql_select_db("Pierre",$db);
$result = mysql_query("SELECT Datum FROM Nyheter ORDER BY Datum DESC",$db);
$getrow = mysql_fetch_row($result);
echo "<h2> Skapad: " . $getrow[$i]. "</h2>";
//Läst in texten
$db=mysql_connect("localhost","pierre","870430");
mysql_select_db("Pierre",$db);
$result = mysql_query("SELECT Textbody FROM Nyheter ORDER BY Datum DESC",$db);
$getrow = mysql_fetch_row($result);
echo "[br]" . $getrow[$i] . "[br][br]";
//Avsluta ifen
}
$i++;
}
?>
By the way, before anyone mentions it:
For loops =