Good day everyone,
I am developing a mini-social site with PHPSocial. I am creating a new table for user_pictures using the following schema:
CREATE TABLE user_pictures(
userpic_id INT NOT NULL AUTO_INCREMENT,
userID INT,
pictures TEXT,
PRIMARY KEY (userpic_id));
My problem is I want to store array of pictures in the pictures field.
Like for example I have 10 pictures that I want to upload, so the data that will be inserted in pictures field will look like this:
1:pic1.jpg;2:pic2.jpg;3:pic3.jpg;4:pic4.jpg;5:pic5.jpg;6:pic6.jpg;7:pic7.jpg;8:pic8.jpg;9:pic9.jpg;10:pic10.jpg
And I want to retrieve the data with the following query:
select pictures from user_pictures
WHERE userid = 1 LIMIT 1;
And store the result data into a an array variable, example:
$pic[‘pictures’] = unserialize($row[‘pictures’]); //Is this possible?
Any idea is appreciated.