hello,
table: users (user_id, user_name)
table: image (image_id, user_id, image)
now, i add a new user with a form, and same form has a 'file' field which uploads the image with it.
so i am sending 2 data records (user_name & image)
user_name will be added to users, and user_id is auto_increment. now i am adding image with the same user_id i just added in user table.
so how do we retrieve the very same record which i just added? fetching the last data record in table is not good enough, as it can get someone else's record who just submitted the query at the same second.
so, i understand we are using foreign keys. and user_id is a foreign key in image table, whereas its primary key in its own table.
any ideas of how to get along with this?
the book i have with me, just skips the foreign keys bit. so i guess i will have to look in to SQL books specificaly.
thanks,
Daarius ...