Jump to content

Inserting an Image into an existing Record?


mikerosenthal

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
Link to comment
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';
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.