trying to build a database for user can upload images and stuff.

i want to do so that 
1-user can upload image
2-name image
3-discribe image
4-how many views that image have
5-how many fav image have
6-list all the messages(comments)
7-number of comments 

so i could need 9 fields?
1-image_id   
2-user_id     (to find out whose image is that)
3-image_name (title)
4-image_describe(some thing about the image)
5-image_views(number of views)
6-image_favs(number of favs)
7-image_ext (jpeg, png, gif)?
8-image_list_comment (list all the comments)
9-image_number_comment(number of comments)



or whould i have only  1 to 7 and last 2 i will have different database for comments????

Recommended Answers

All 4 Replies

Image to comment is a one-to-many relationship, so a separate table is recommended.

so for image table i will have :

1-image_id   
2-user_id     (to find out whose image is that)
3-image_name (title)
4-image_describe(some thing about the image)
5-image_views(number of views)
6-image_favs(number of favs)



and for comment to image table i will have:
comment_id
user_id
image_id
image_list_comment (list all the comments)
mage_number_comment(number of comments)

You would just need 16 to be comment. 17 is superfluous as you can use a query to count them.

Wouldn't you also need a field for the actual image ( or the path of the actual image, depending on what you are trying to implement)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.