• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.