Kan ikke få den til og vise på side 2 etc. og hvis man går til side 2 kan man ikke komme tilbage til side 1
<?
$unitsperpage = 5;
$result = mysql_query("SELECT * FROM news_nyhederne");
$num = mysql_num_rows($result);
$total_pages = ceil($num / $unitsperpage);
if (!$show_page) {
$show_page = 1;
}
$show_page = $show_page - 1;
$current_number = $show_page * $unitsperpage;
$result = mysql_query("SELECT * FROM news_nyhederne WHERE cat='".$_GET['name']."' ORDER BY id DESC LIMIT $current_number,$unitsperpage");
while ($row = mysql_fetch_array($result)) {
?>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="left">
<div class="medium">
<a href="index.php?page=nyheder_shownyhed&id=<?=$row['id']?>"><?=$row['topic']?></a>
</div>
</td>
<td align="right">
<div class="medium">
<?=$row['dato']?>
</div>
</td>
</tr>
</table>
<?
}
echo"<center>";
if ($show_page != 0) {
$new_page = $show_page;
echo"<a href='index.php?page=nyheder_show_cat&name=Computer$_GET[name]&show_page=$new_page'><<</a> - ";
}
else {
echo"<< - ";
}
$counting_pages = 0;
while ($total_pages > $counting_pages) {
$counting_pages++;
if ($show_page == $counting_pages - 1) {
echo "$counting_pages - ";
} else {
echo "<a href='index.php?page=nyheder_show_cat&name=Computer$_GET[name]&show_page=$counting_pages'>$counting_pages</a> - ";
}
}
if ($show_page != $total_pages - 1) {
$new_page = $show_page + 2;
echo"<a href='index.php?page=nyheder_show_cat&name=Computer$_GET[name]&show_page=$new_page'>>></a>";
} else {
echo">>";
}
echo"</center>";
?>
<?
$e = $_GET["e"];
$a = 10 * $e;
$b = $a + 10 - $e * 10;
$c = $e - 1;
$d = $e + 1;
mysql_connect($db_host,$db_username,$db_password) or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
$query = mysql_query("SELECT * FROM guestbook") or die (mysql_error());
$total = mysql_num_rows($query);
$pages = $total / 10;
if($e + 1 < $pages OR $d=="$pages"){ $next = "<a
href=\\"gb.php&e=$d\\">Next 10 >></a>"; }
if($e - 1 < $pages AND $e){ $prev = "<a
href=\\"gb.php&e=$c\\"><< Previous 10</a>"; }
else{ $prev = "<font class=\\"inactive\\"><< Previous
10</font>"; }
if($d > $pages){ $next = "<font class=\\"inactive\\">Next 10
>></font>"; }
echo "<br>\\n$prev ][ $next<br>\\n";
$query = "SELECT * FROM guestbook order by id DESC LIMIT $a,$b";
$result = mysql_query($query);
echo "<br><br><table align='left' width='75%' cellpadding='4' cellspacing='1' style='border: 0px solid'>";
while($r=mysql_fetch_array($result))
{
$message = stripslashes(nl2br($r[message]));
$date = $r[date];
$name = $r[name];
$email = $r[email];
echo "<tr>";
echo "<td style='border: 0px solid'><font size=3>Posted By: <a href='mailto:$email'>$name</a><font size=3>
$date</td>";
echo "</tr>";
echo "<tr>";
echo "<td style='border: 0px solid'><font size=2>
$message</td>";
echo "</tr>";
echo "<tr>";
echo "<td style='border: 0px solid;'><hr style='border: 1px solid;' color='#000000'>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
?>
Her bliver det brugt i en gæstebog... Du kan se hele scriptet på
http://www.esfmod.net/home.php?id=gb_tutorial.php&menu=-----------------------------
Hvad er det der lugter af? Jeg tror det er....
NUMSEFISK!!!!!!!!!!
www.numsefisk.dk
-----------------------------