I want the default value when viewcomic.php is run to be the latest comic (i.e. the greatest value of comicID in the table), and so that when you are on the latest comic the 'next' link does not work, and on the first comic the 'previous' button does not work.
I tried an IF statement but I had trouble getting the URL within that to work. So, can anyone help me with any of these problems? Thanks in advance if you can. Here's the script at the moment, which is located at http://www.silverferret.co.uk/sc17/view ... ?comicID=1 :
Code: Select all
<?php
$dbhost = 'localhost';
$dbname = 'silverf_website';
$dbuser = 'silverf_dan';
$dbpasswd = '*******';
$connection=mysql_connect($dbhost,$dbuser,$dbpasswd)
or die("Could not connect to server");
$db=mysql_select_db($dbname,$connection)
or die("Could not select database");
$comicID = $_GETї'comicID'];
$query="SELECT * FROM Comic WHERE comicID=$comicID";
$result=mysql_query($query)
or die ("Could not execute query");
//Get the results
$row=mysql_fetch_array($result);
extract($row);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Spin City 17 - <?php print($comicTitle); ?></title>
</head>
<body>
<?php print($comicTitle);?><br>
<a href="<?php print('http://www.silverferret.co.uk/sc17/viewcomic.php?comicID='.($comicID+1)); ?>">Next</a> | <a href="<?php print('http://www.silverferret.co.uk/sc17/viewcomic.php?comicID='.($comicID-1)); ?>">Previous</a>
<br>
<img src="<?php print($comicURL); ?>" alt="Spin City 17">
</body>
</html>