June 19th, 2000, 03:29 PM
I have a simple script submits a name and number to a MySql database and its searchable, Now i want to take it to the next level and attach a picture to the name and number that i submit and have the picture show up when i run a query for the name. what is the best possible way to doing this? Thanks so much
June 19th, 2000, 11:29 PM
First you need to decide whether u want to store the actual picture in the database...or just store the url to the picture in the database.
If you just want the link in the database.. go here http://www.evilwalrus.com/viewcode.p...code_php&id=27 to see how u do it.
For the other method...i dunno I saw a tutorial on it at one of the big sites once though
June 19th, 2000, 11:30 PM
the command for adding a column to the mysql table is:
alter table <table_name> add column picture varchar(20);
it's easier if all of your images are stored in one directory, that way you can just save the name, instead of all the path info. if you do have to store path info, you might want to make varchar larger than 20.
then, to get the data back out...
$query = mysql_db_query($database,"select picture from table_name where name='$name');
$result = mysql_fetch_array($query);
then, where ever you want to show the picture, use:
<img src="images/<?php echo $result["picture"]; ?>" border=0>
Hopefully that get's you going, email me if you have any other questions.