Jump to content

If statement not working


adam291086

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.