I have a database, which I should able user to upload multiple images to his account,
How could I do this in MySQL database and its PHP code to insert them.
Here what I tried, I created 2 tables
CREATE TABLE `user` (
`userID` int(11) unsigned NOT NULL auto_increment,
`imageID` int(11) unsigned NOT NULL,
PRIMARY KEY (`id`)
)
CREATE TABLE `iamges` (
`imageID` int(11) unsigned NOT NULL auto_increment,
PRIMARY KEY (`imageID`)
)
so, each user can upload multiple images through imageID and in the images table I will put image1, image2 etc.
When I want to select them I will use :
SELECT user.name, Persons.email, images.image1, images.image2
FROM user
INNER JOIN images
ON user.imageID=images.imageID
ORDER BY Persons.name
But, how could I do insert into the 2 tables at once when the user upload multiple images ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…