Jump to content

Recommended Posts

id int NOT NULL AUTO_INCREMENT PRIMARY KEY
user_id int NOT NULL
image_name varchar(50) NOT NULL
caption varchar(100)

 

Ok. You'll have the normal 'id' field. The 'user_id' field is the id of the user to which the image belongs.

 

Then the 'image_name' field. It depends on how you set up your directory. Some people throw them all in one directory and some others set up each member with their own folder under the 'images' directory to keep them kind of organized. However you set it up, when you are linking to the image in HTML, you'll be able to insert the path there and just pull the image name from the table. And if you want to give the user their own folder, you'll be able to throw their username in the path there as well.

 

Then there is the optional 'caption' field for holding a little description of the pic.

 

You'll need a separate table for the ratings.

 

id int NOT NULL AUTO_INCREMENT PRIMARY KEY
image_id int NOT NULL
rating int NOT NULL

 

The id field will keep track of the ratings. The image_id field is the id of the image that has been rated. And the rating of course will be the rating, however you set them up.

 

There might be better ways to do it, but this is what I came up with in a few minutes.

 

Jeremy

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.