tags:

views:

26

answers:

4

I am making an application in which every user have to sign in first and then he can access his home page.Now on home page i have given a option of uploading image.Now if user is uploading one image i am storing the full path of uploaded image into database and from there i can display image easily by img tag...

But what should i do when user want to upload many images.Then how i should store their full paths in database for same user.Give me an idea just like orkut or facebook.Should i amade a differnt table named images and i should store images in differnt rows with same username..Plz explain what showuld i do..I dont know the logic what showild i do...How i can upload many images and how i can store thri path and what will be the wisest method and how to display many images on one page(i can display one )

A: 

This seems to be more of a design question than a PHP question. I would create a separate table to store all paths, this is more normalized.

You still need to handle the UI, but if you are doing a sort of gallery then that is fairly simple with some jQuery sideshows or something like that.

Dustin Laine
Ok fine suppose i am creating a table for all images uplaoded by all users but how one will differnciate that this is his/her image showuld i associate users name that is unique for each user with uploaded file so that images can be distinguished
Deepak Narwal
Add a column for user id, which should be a foreign key to the users table.
Dustin Laine
A: 

you can make a folder, named after user name/id
and put all their images there

to display many images on one page just add more <img> tags to the page

Col. Shrapnel
is it possible that as new user sign up ,at the same time a new folder with his name created so that i can put all images into this..I think i cant manually make folder of user name for each user..
Deepak Narwal
mkdir() is the function for create folders
Col. Shrapnel
A: 

Yes, you want to use a separate table to store the image paths. You'll most likely want a record ID, the User ID, and the path to the image. You could also add a field to contain the sorting order for the images.

Having the sorting order field will allow you to page through the photos if there is more than one page of photos.

37Stars
A: 

Friend ok i am making a new table in which i am storing images full path with image id with user name.NOw if i want to select images from table like select id from table where name=username and this loop will execute untill all images are displayed...Plz guide me about this i am not getting code and little bit confused even about struture of table

Deepak Narwal