echoing images from mysql?

Nik

New member
Right so far I have connected successfully with no errors I have also got it connected to the right table but how would I have PHP echo the databases images as well as its text here is how I have it so far.

MYSQL DB
_______________________________________
4 rows
id, int auto increment
image, blob
name, text
contact, text

right thats the db now the PHP so far

$host = "test";
$username = "test";
$password = "test";
$dbname = "db";
$dbtable = "members";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$dbname")or die("cannot select DB");
$sql = "SELECT image,name,contact FROM $dbtable ";
$result = mysql_query($sql);

?>

the code does not error at all I'm just stuck as to what to do next what I need is for PHP to echo the 3 rows excluding the row ID how google does with the image then its name below it then the contact number below that. Also there are going to be about 7 peopleto echo so I need them also how Google displays them side by side across then down the page.

Anyone have any ideas thanks for any help cheers nik
ok so explain this to me in detail of what I do Am i storing the file path of the image if so how would I get the address.
one last thing would it be ok to store the image in some cases as one of the pages will only ever contain around 10 images.
 
Hi.
As a professional php/mysql developer, I don't advise you to store images in the database for many reasons. Some of the reasons are as follows :
1- Your database gets bigger and bigger and it takes a lot of resources and time to back it up.
2- Your queries will run slowly.
3- It's not possible to easily change an image. You must do a database update for each image you want to change.
4- Images don't have a file-based url.
5- Storing images takes longer as you need to first upload them and then store the uploaded file in the database.

It's best to store the location of your images in the table and show them in your web pages.
 
Hi.
As a professional php/mysql developer, I don't advise you to store images in the database for many reasons. Some of the reasons are as follows :
1- Your database gets bigger and bigger and it takes a lot of resources and time to back it up.
2- Your queries will run slowly.
3- It's not possible to easily change an image. You must do a database update for each image you want to change.
4- Images don't have a file-based url.
5- Storing images takes longer as you need to first upload them and then store the uploaded file in the database.

It's best to store the location of your images in the table and show them in your web pages.
 
Back
Top