Welcome Guest, Not a member yet? Register   Sign In
If the id doesn't exist how to redirect to id=1? PHP/MySQL?
#1

[eluser]Unknown[/eluser]
I made a "next button" and it displays the following pages even though such id does not exist

Next button
echo "<a href='catalog2.php?id=" . ++$id . "'><h3>Next >>></h3></a>";

Display image on page

$id = $_GET['id'];

$query = mysql_query("SELECT * FROM demotivators WHERE id = '$id' LIMIT 1") or die(mysql_error());



$row = mysql_fetch_object($query);

echo $row->image1 . "
";
#2

[eluser]CroNiX[/eluser]
Please read my sig on how to use code tags so we can read what you meant for us to read.




Theme © iAndrew 2016 - Forum software by © MyBB