Page 1 of 1

Creating Blobs

Posted: Wed Mar 17, 2004 6:47 am
by James138
Hi,
Im trying to get my site to retrieve pictures from the database. Ive been told the picture has to be named as a BLOB. I have since done this. But how do i add pictures to this field within mysql? Because I dont know which folder the images should be stored in at the moment:?

Cheers

Posted: Wed Mar 17, 2004 6:52 am
by Joe
$sql = "SELECT * FROM table";
$result = mysql_query($sql) or die(mysql_error());

if (mysql_num_rows($result))
{
$row = mysql_fetch_assoc($result);
echo "<img src='".$row['pic']."'>";

etc, etc...

Hope that helps!

Regards


Joe 8)

Posted: Wed Mar 17, 2004 7:01 am
by James138
Thanks! :D

Posted: Wed Mar 17, 2004 7:05 am
by Joe
No problem!

Posted: Wed Mar 17, 2004 9:46 pm
by James138
Hi,
im having a slight problem in the fact that when i call up the picture it is just displaying a load of jumbled up text. has anyone got any ides why?

Regards
James

Posted: Wed Mar 17, 2004 11:38 pm
by microthick
James, read this tutorial:
http://www.phpbuilder.com/columns/florian19991014.php3

This is what I learned from for storing images as blobs in a db.

Posted: Fri Mar 19, 2004 10:03 am
by James138
Hi,
I have created a blob for my picture within my database, but the picture is appearing as alot of scrambled text. Any ideas why this is happening? :?