View Single Post
  #1 (permalink)  
Old 09-27-09, 05:52 PM
ryanfern86goa ryanfern86goa is offline
New Member
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
how to fetch image from mysql using php

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
PHP 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

Last edited by Nico; 09-27-09 at 05:55 PM.
Reply With Quote