I'm assuming all this data is coming in from a form - somewhere in the
manual (too lazy at the monent to look where) there's a section on how to
upload files. Once a file is uploaded (in your case, an image), just move it
to somewhere accessable. Have field in the database that contains the name
of the image so when you come to display it, you'll know if there's an image
for that record...

Hope that helps.


-----Original Message-----
From: will hives [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 22, 2002 10:01 AM
Subject: [PHP] file upload with story

Please can someone help, I can't find any answers anywhere....

I have this code:


$db_name = "name";

$table_name = "my_contacts";

$connection = @mysql_connect("www.myserver.net", "username", "password") or
die ("couldn't connect.");

$db = @mysql_select_db($db_name, $connection) or die ("couldn't select

$sql = "INSERT INTO $table_name
(id, fname, lname, address1, address2, address3, postcode, country,
prim_tel, sec_tel, fax, email, birthday)
(\"\", \"$fname\", \"$lname\", \"$address1\", \"$address2\", \"$address3\",
\"$postcode\", \"$country\", \"$prim_tel\", \"$sec_tel\", \"$fax\",
\"$email\", \"$birthday\") ";

$result = @mysql_query($sql, $connection) or die ("couldn't execute query");


it's really just an online contacts book, what I want to do as have the
ability to upload an image with the record.

Then when the contact details are viewed it shows the also uploaded image.

How do I add that code into this...any help would be fantastic.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to