从数据库调用图像获取ID

Here is my problem. I am uploading images to my database but when I want to display them I cannot call the ID of the image. How do I get it to fetch the ID. If I specify the $id = 1 like so, it calls the image no problem when I use view.php?=1 etc but how do I get it so when is use the view.php?id=1 call it gets the id from the address? what have I done wrong or need to do? below is the code I have used to call the image thanks in advance

mysql_connect($host, $username, $password) or die("Can not connect to database: ".mysql_error());

mysql_select_db($database) or die("Can not select the database: ".mysql_error());

$id = $_GET['id'];

if(!isset($id) || empty($id) || !is_int($id)){
 die("Please select your image!");
}else{

$query = mysql_query("SELECT * FROM tbl_images WHERE id='".$id."'");
$row = mysql_fetch_array($query);
$content = $row['image'];

header('Content-type: image/jpg');
 echo $content;
}

Don't use is_int(), because it checks if the variable is of type integer, and $_GET will always return a string, never an integer.

You want to use is_numeric instead.