YOur code is in need of some enhancements:
<?
include("connection.inc");
$bye=$_GET['id'];
/
echo errors, maybe your connection is not good, wrong db, etc.
/
$sql = "DELETE FROM photos WHERE code=$bye";
$result = mysql_query($sql) or die(mysql_error() . ' for sql query: '.$sql);
if($x=mysql_affected_rows($result)){
echo "$x photo(s) deleted";
}else{
//means that nothing matched $bye..
}
?>