adam291086 Posted October 4, 2007 Share Posted October 4, 2007 I am wanting to run an if statement that say, if the picture location in the database = empty then redirect to another page else run the following code. At the moment nothing is happening. What wrong with the code. <?php include("config.php"); if( !$_GET['photo_id'] ){ $msg .= "No photo selected! Please <a href=\"gallery.php\">choose an album</a> you would like to view."; // Display error message displayPage($msg); die(); } if (empty($_GET['photo_id'])) { header("Location: http://www.adamplowman.co.uk"); } else $con; $sql = "SELECT photo_title, photo_location, album_id FROM photos WHERE photo_id = " . addslashes($_GET['photo_id']); $result = @mysql_query($sql) or die("Error retrieving record: " . mysql_error()); while($row = @mysql_fetch_array($result)){ $photo_title = $row['photo_title']; $photo_loc = $row['photo_location']; $album = $row['album_id']; $next = $_GET['photo_id']+1; $previous = $_GET['photo_id']-1; } ?> Link to comment https://forums.phpfreaks.com/topic/71787-if-statement-not-working/ Share on other sites More sharing options...
heckenschutze Posted October 4, 2007 Share Posted October 4, 2007 Don't dump the entire code here and expect us to sift through it to find your problem, learn how to debug. Link to comment https://forums.phpfreaks.com/topic/71787-if-statement-not-working/#findComment-361505 Share on other sites More sharing options...
adam291086 Posted October 4, 2007 Author Share Posted October 4, 2007 I have changed the code, the only thing not working is the if statement searching for a empty feild. Link to comment https://forums.phpfreaks.com/topic/71787-if-statement-not-working/#findComment-361509 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.