Create image DB / php integration

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 4
Joined: Fri Jan 04, 2013 1:58 pm

Sun Jan 06, 2013 2:34 am

here is an example for you. I havent tried it yet but I think it should work properly.

Arif Yılmaz

Code: Select all

$username = ""; 
$password = ""; 
$host = "localhost"; 
$database = ""; 
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; } ?>

Post Reply