I have a similar need... adding an image reference to a MySQL database and then summoning the image reference into a web page separately. My setup involves a simple portfolio with an image of the website as part of the display. The way mine works is so similar to the 'news' insertion issue that I thought i'd join this thread instead of starting a new one.
My portfolio entries could work the same way where they have an 'id' number assigned. Then, the image could be assigned to that id if i'm understanding correctly. That would match the two up in any case.
My first question would be pertaining to your code about the INSERT statement. I'm a noob so bear with me
I'm assuming that the INSERT statement for the image has to be a separate INSERT statement from the data... ? In other words, from the form entry input i'm inserting the results into a database. One of the fields is the 'image' field. When i'm writing the INSERT code I have this:
mysql_query("INSERT INTO portfolio
(site_name, url, description, details, thumbnail) VALUES('$name', '$url', '$descr', '$details', '$image') ") or die(mysql_error());
The variables are as so:
$name = $_POST['site_name'];
$url = $_POST['url'];
$descr = $_POST['description'];
$details = $_POST['details'];
$image = $_POST['thumbnail'];
$uploadDir = "images/";
So, basically I complete the form and upon submit it should open the DB and enter the data. However, the 'image' part is confusing to me since I know that the image itself doesn't reside in the DB but the reference to it does. So, I need to assign the reference...?