Jump to content

Help with storing images in a database and echoing it on a page.


kizzie

Recommended Posts

Pls i really need help with storing images in a database.I created a field in the database named 'PICS' with type as 'blob'. But i dont know whether the image file path should be stored in the database then the image itself stored in a folder or if the image should be stored in the database.And also how do i echo the image? I really need this script pls. Thanks... Waiting...

Just make a folder on your webserver called images.

 

example database :

 

Id  |  URL

--------

0  | images/image1.jpg

1  | images/image2.jpg

 

$conn = mysql_connect(localhost, user, password) or die 	('Error connection to mysql');
mysql_select_db(dbname) or die (mysql_error());

while($row = mysql_fetch_array($result)){
		echo "<img src='". $row['url'] . "' width='500' height='200'>";
	}

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.