# \[PHP\]problem with id=0

**URL:** <https://forum.kirupa.com/t/php-problem-with-id-0/33086>\
**Category:** programming\
**Created:** [October 15, 2003, 2:18am UTC](https://forum.kirupa.com/t/php-problem-with-id-0/33086 "2003-10-15T02:18:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzman121](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jazzman121/32/127_2.png) [@jazzman121](https://forum.kirupa.com/u/jazzman121)\
**Post date:** [October 15, 2003, 2:18am UTC](https://forum.kirupa.com/t/php-problem-with-id-0/33086/1 "2003-10-15T02:18:49Z")

</div>

```php

<?
$id = $_GET['id'];
if($id){
@mysql_connect("localhost","username","pswd");
    @mysql_select_db("db_name");
$query ="SELECT file,type FROM db_table WHERE id=$id";	
$result = @mysql_query($query);
$data = @mysql_result($result,0,"file");
$type = @mysql_result($result,0,"type");

Header( "Content-type: $type");
echo $data;
};
?>

```

ok when i use this to get an image from a blob i set the url as get\_img.php?id=1

or watever and it works fine  
works for all fields except 0  
dont understnad why … i hope my question makes sense

like [http://www.mysite.com/get\_img.php?id=0](http://www.mysite.com/get_img.php?id=0)

doesnt work but every field after that works fine

[http://www.mysite.com/get\_img.php?id=1](http://www.mysite.com/get_img.php?id=1)  
[http://www.mysite.com/get\_img.php?id=2](http://www.mysite.com/get_img.php?id=2)  
[http://www.mysite.com/get\_img.php?id=3](http://www.mysite.com/get_img.php?id=3)

and so on and so forth

thanks
