[thelist] basic mysql key question.
kris burford [midtempo]
kris at midtempo.net
Mon Apr 22 05:16:01 CDT 2002
hi all,
i'm playing with mysql/php and have a cms system where i have two tables.
table_story has story_id, story_text and image_id
table_images has image_id, image_name, image_height and image_width
table_images.image_id is set to auto_increment.
if i insert a new image, what is the easiest means of updating
table_story.image_id
my poor brain is thinking that i have to:
1. insert into table_images
2. select image_id from table_images where image_name = image_name
3. update table_story
in three separate database queries - which to me seems like a rather basic
and inelegant means of doing this.
could someone point me in the right direction?
thanks
kris
More information about the thelist
mailing list