Jump to content

Archived

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

mikerosenthal

Inserting an Image into an existing Record?

Recommended Posts

OK. i really have been trying to do this for weeks, but keep in mind i am more or less a newbie...

I have setup an event calendar system wherein the administrator creates a new event from a calendar (well, from the php script webcalendar - http://www.k5n.us/webcalendar.php). once this event is created, she can then go to an Event Editor page i built, where she can fill out a lot more information about the event (price, description, staffing, etc). I would also like for her to be able to insert an image into this existing record while she is filling out all this other info, then hit save, and have all this info and the image saved with the record.

I have read many tutorials on how to upload and display images using php and mysql. I have gotten these to work just fine. however, none of them seem to take into account the scenerio of wanting to upload an image into an existing record (ie, they all create a new unique id), whereas i need the example to take into account the unique id of whatever record she is editing and replace into (or insert into? im confused) that one.

i realize this is a slightly confusing post, so please feel free to ask me to clarify a point or post an example. but does anyone understand my confusion? or can anyone point me to a tutorial on uploading images into existing mysql records from php?

thanks for your help!

-mike

Share this post


Link to post
Share on other sites
At the moment you probably have something like

UPDATE events SET
    description = '$description',
    price = '$price'
WHERE eventid = '$id';

Having uploaded the image and moved to "$path/$filename" on the server, your update becomes

UPDATE events SET
    description = '$description',
    price = '$price',
    image = '$path/$filename'
WHERE eventid = '$id';

Share this post


Link to post
Share on other sites
Not recomended, better to store file on server and the link to it in the db

Share this post


Link to post
Share on other sites

×

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.