If the id doesn't exist how to redirect to id=1? PHP/MySQL? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: If the id doesn't exist how to redirect to id=1? PHP/MySQL? (/showthread.php?tid=53799) |
If the id doesn't exist how to redirect to id=1? PHP/MySQL? - El Forum - 08-09-2012 [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 . " "; If the id doesn't exist how to redirect to id=1? PHP/MySQL? - El Forum - 08-09-2012 [eluser]CroNiX[/eluser] Please read my sig on how to use code tags so we can read what you meant for us to read. |