Witam, mam taki problem podczas robienia news'ów ze stronnicowaniem. Mam w bazie 3 newsy a wyświetla mi tylko jeden (ostatni wedłg daty i czasu dodania) i nie mogę znaleźć błędu w kodzie.
<?php
if (!isset($first)) { $first = 0; } $ltmp = \"5\";
$sql = \"SELECT * FROM news ORDER BY news_date DESC , news_time DESC LIMIT $first,$l
t
p\";
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result)) {
$sql = \"SELECT * from users WHERE user_id = '$row[news_auth_id]'\";
$result = $db->sql_query($sql);
$data = explode(\"-\", $row[news_date]);
$row2 = $db->sql_fetchrow($result);
echo \"
<font face=\"Verdana\" size=\"2\"><b>$row[news_heading]</b> <FONT SIZE=\"1\"><A HREF=\"mailto:$row2[user_mail]\">$row2[user_nick]</A> / \".substr($row[news_time],0,5).\" / $data[2]-$data[1]-$data[0]</FONT><br />
$row[news_body]</font><FONT SIZE=\"2\"><BR /><BR />
\";
}
$sql = \"select * from news\";
$count = $db->sql_numrows($db->sql_query($sql));
$count = $count/$ltmp;
print (\"<P ALIGN=\"CENTER\">\"); if ($first!=0
) print (\"<a href=\"index.php?go=main&first=\" . ($first-$ltmp) . \"\" title=\"Last page\"><big>«</big></a> \");
for ($i=1;$i<=$ile;$i++)
{
print (\"<a href=\"index.php?go=main&first=\" . ($i*$ltmp-$ltmp) . \"\" title=\"\" . ($i*$ltmp-($ltmp-1)) . \"-\" . ($i*$ltmp) .\"\">\");
if ($first==($i*$ltmp-$ltmp))
{
print (\"<b>[\" . $i . \"]</b></a> \"); $akt=$i; } else { print (\"[\" . $i . \"]</a> \"); }
}
if ($akt<$ile){ print (\"<a href=\"index.php?go=main&first=\" . ($first+$ltmp) . \"\" title=\"Next page\"><big>»</big></a>\");
}
?>
Z góry thx za pomoc
Ten post edytował peterj 28.01.2005, 11:42:22