The PHP Code below is getting information from the database.
The database at this point has 7 rows but the file for some reason only gets the last five and does not start at 1.
It should display the first 5 lines from the database and then the next two once I click on "Weiter".
As there could be a larger number than 7 rows in the database it needs to adjust to it. So if there are 14 lines it would display the 5 newest, than the next 5 and then the oldest 4 etc.
Do not bid more than 10 Dollars as this should be an easy fix for someone who knows what they are doing.
If you place a bid I assume you have no questions and you are clear with the demands.
<?php
$result = mysql_query("SELECT UserID,Datum,Headline,Meldung,IconID FROM tippliga_news ORDER BY Datum DESC;");
$treffer = mysql_num_rows($result);
echo "<br><br>\n";
if (!isset($start)) { $start = 0; }
$anfang = $start+1;
$ende = $start+5;
if ($treffer<$ende) { $ende=$treffer; }
echo "<strong class='innertxt'>News Archiv ...<br>Nachricht $anfang bis $ende von $treffer</strong><br>\n";
$neu = $start - 5;
if ($neu >= 0)
{
echo "<a href=\"[login to view URL]".$neu."\" target=\"_self\">Zurück</a>\n";
if ($start+6 < $treffer)
{
echo " - ";
}
}
$neu = $start + 5;
if ($neu<$treffer)
{
echo "<a href=\"[login to view URL]".$neu."\" target=\"_self\">Weiter</a>\n";
}
echo "<br><br>\n";
for ($i=$start; $i<$start+5; $i++)
{
$ii = $i;
if ($i>=$treffer) { break; }
$e1 = mysql_result($result,$ii,"Headline");
$e2 = mysql_result($result,$ii,"Meldung");
$d = mysql_result($result,$ii,"Datum");
$iconid = mysql_result($result,$ii,"IconID");
$icon = mysql_query("SELECT Datei from tippliga_icons Where IconID='$iconid';");
$iconurl = mysql_result($icon,0,"Datei");
$userid = mysql_result($result,$ii,"UserID");
$u = mysql_query("SELECT user from tippliga_user Where UserID='$userid';");
$user = mysql_result($u,0,"user");
$d_neu = strftime("%H:%M:%S - %d.%m.%Y",strtotime($d));
echo "<span class='innertxt'><img src=\"$iconurl\"><b><i> $e1 </b></i> - von $user ($d_neu)</span><br></i>\n";
echo "<span class='innertxt'>$e2</span>\n\n";
if ($i+1 < $start+5) { echo "<br><br>\n"; }
}
?>