RE: [PHP] How to store an image into a mysql database using php language?

2002-07-23 Thread John Holmes

There's no reason to store images in a database. It's a waste of time
and it's a slower process than just loading it off the disk. 

If you still want to know how to do it, search the web. This question is
asked every day and there are a couple dozen tutorials out there that'll
tell you exactly how to do it. 

---John Holmes...

> -Original Message-
> From: Rija [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 22, 2002 11:03 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] How to store an image into a mysql database using php
> language?
> 
> I want to store image data into mysql table using BLOB but I don't
know
> how to read it after. To record the image, I doesn't have any problem,
but
> to read the file after and to view the image, I can't do anything the
> variable show only comment like this: memobin24.bin
> 
> So how can I do?
> 
> This was the script.
> 
>  
> Include("connect.inc") ;
> 
> $fp = fopen("image/photo.jpg","r") ;
> 
> if ($fp) {
> 
> $code2 = "" ;
> 
> while (!feof($fp)) {
> 
> $buffer = fgets($fp, 4096);
> 
> $code2 = $code2.$buffer;
> 
> }
> 
> }
> 
> $code2 = addslashes($code2) ;
> 
> $table = 'image' ;
> 
> $instruction = mysql_query("INSERT into $table values ('','fichier
> inage','$code2','') or die("FATAL ERROR") ;
> 
> ?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] How to store an image into a mysql database using php language?

2002-07-22 Thread Rija

I want to store image data into mysql table using BLOB but I don't know how to read it 
after. To record the image, I doesn't have any problem, but to read the file after and 
to view the image, I can't do anything the variable show only comment like this: 
memobin24.bin

So how can I do?

This was the script.