how to display images from my database using php
Posted: Sun Sep 27, 2009 4:14 pm
hi there
I have created a table $query2="CREATE TABLE '$user1' ( id tinyint(3) unsigned not null auto_increment,
image blob not null, primary key(id))";
I have inserted quite a few pictures in it... when i try to display or fetch them i only get one picture dispalyed, thats the pic with id 1.heres my code
<? session_start(); ?>
<?php
$user1=$_SESSION["user1"];
$pass1=$_SESSION["pass1"];
@mysql_connect("localhost", "abc", "abcd") or die("Can not connect to database: ".mysql_error());
@mysql_select_db('test') or die("Can not select the database: ".mysql_error());
$query = mysql_query('select image from $user1');
$row = mysql_fetch_array($query);
$content = $row['image'];
header('Content-type:image/jpg');
echo$content;
?>
i want to display all the pictures in that database..
Any help would be appreciated.. thanks
I have created a table $query2="CREATE TABLE '$user1' ( id tinyint(3) unsigned not null auto_increment,
image blob not null, primary key(id))";
I have inserted quite a few pictures in it... when i try to display or fetch them i only get one picture dispalyed, thats the pic with id 1.heres my code
<? session_start(); ?>
<?php
$user1=$_SESSION["user1"];
$pass1=$_SESSION["pass1"];
@mysql_connect("localhost", "abc", "abcd") or die("Can not connect to database: ".mysql_error());
@mysql_select_db('test') or die("Can not select the database: ".mysql_error());
$query = mysql_query('select image from $user1');
$row = mysql_fetch_array($query);
$content = $row['image'];
header('Content-type:image/jpg');
echo$content;
?>
i want to display all the pictures in that database..
Any help would be appreciated.. thanks