Ik heb een vraagje, ik ben bezig met een comic systeem te bouwen @ http://comics.doekie.nl en nou heb ik het probleem dat als de comic bij de eerste of de laatste is je gewoon door kan klikken naar bijv: 0, -1, -2, -3, etc etc. Ook bij de laatste kun je door klikken naar 100, al lopen de comics maar tot 67.
Hier is mijn code:
Hier is mijn code:
PHP:
$comicID = $_GET['comicID'];
if ($comicID != null) {
$sql = mysql_query("SELECT * FROM comics WHERE comicID = '$comicID'") or die (mysql_error());
} else {
$sql = mysql_query("SELECT * FROM comics ORDER BY comicID DESC LIMIT 0,1") or die (mysql_error());
}
if ($row=mysql_fetch_array($sql)) {
$comicID=$row['comicID'];
$datum=$row['datum'];
$titel=$row['titel'];
$comic=$row['comic'];
}
$First = $comicID - $comicID + 1;
$Prev = $comicID - 1;
$Next = $comicID + 1;
$Last = $comicID == 0;
if ($comicID == 0) {
$output = "";
if ($comicID == 1) {
$output = "";
} else {
$output = "";
}
}
$output = "
<table align='center'>
<tr>
<td align='left'>$comicID</td>
<td colspan='2' align='middle'>$titel</td>
<td align='right'>$datum</td>
</tr>
<tr>
<td colspan='4'><img src='$comic'></td>
</tr>
<tr>
<td width='25%' align='middle'>
<a href='index.php?comicID=$First'><img src='http://comics.doekie.nl/img/first.png'></a>
</td>
<td width='25%' align='middle'>
<a href='index.php?comicID=$Prev'><img src='http://comics.doekie.nl/img/prev.png'></a>
</td>
<td width='25%' align='middle'>
<a href='index.php?comicID=$Next'><img src='http://comics.doekie.nl/img/next.png'></a>
</td>
<td width='25%' align='middle'>
<a href='index.php?comicID=$Last'><img src='http://comics.doekie.nl/img/last.png'></a>
</td>
</tr>
</table>";
echo $output;