Page 1 of 1
photo album and tags
Posted: Thu Jul 22, 2010 10:59 am
by rob1
hi im new here and could do with a helpful nudge in the right direction.
ive managed to create a simple photo album site and have 3 tables (category,images, and img-cat) set up to deal with the tagging of items with in each photo using check boxes. the two things i need help with now are:
how can i create sub category's for each category using the 'link' table ? ie group 'people' and maybe have a master check box to check/uncheck all people then another box for 'places/locations' etc etc
how do i get the MYSQL db to preselect items that have been entered into the DB with a 'tag' already?
thanks in advance for your help!
Re: photo album and tags
Posted: Thu Jul 22, 2010 1:41 pm
by Gargoyle
consider rephrasing your post. I read it three times and I am still not sure what you are trying to do.
Re: photo album and tags
Posted: Thu Jul 22, 2010 6:05 pm
by rob1
for each photo in the album i have a list of check boxes that are used as categories, so i may have a tick box for each of my family members and friends so i can search for them as keywords. I then want to have keywords for locations, ie friends house, or holiday in australia, but rather than having one big column full of tick boxes I wanted to be able to break them down into subcategories, so it helps keep things less cluttered and easier to use.
i understand that to use a many to many relationship with the database i need to have a table with details of the images and another table for the categories then to use a table to join the two, but its the extra element of breaking this down into another level, - sub categories, with many to many ?
im also a little stuck with my check box array trying get it to preselect items already selected, as obviously i dont want to create null values for every keyword and link them to every image as that would just be a waste of resources...
does that make a little more sense with what im trying to do, as all i want is the ability to select keywords for each image i upload to the website ?
Re: photo album and tags
Posted: Fri Jul 23, 2010 12:34 am
by Gargoyle
well,you need a category table like this:
cat_id # the category id
ca_id_parent # the cat_id of the parent category
cat_title # category title
etc.
the first category level would have 0 as cat_id_parent.
all others would have cat_id of the parent category as cat_id_parent.
as for the checkboxes, you would read all categories and then check them against the "link" table. if no entry exists, the checkbox stays unchecked.