Jump to content

Help with Complex Code Merging & Liking Tables


chillexistence

Recommended Posts

Hi,

I'm somewhat new to the whole PHP & MySQL database and currently working on a complex project and need some assistance.

 

I have 3 basic tables,

Table 1 contains the following info

Image_ID, & all related pictures info

 

Table2 contains the follwoing info

Gallery_ID, Gallery_Title, Gallery_Description

 

Table3 contains 3 things

ID, Gallery_ID, Image_ID

 

what i want to do is be able to assign multiple pictures to multiple galleries and some images might appear in several galleries. So of course a sample entry in table 3 might be

ID-1, Gallery_ID-12, Image_ID-16

 

 

but where i need the help is I want to be able to add, and update which galleries images are in, so i'm putting all the possible galleries into a drop-down box that allows multiple selections, but I'm not sure how to have it search to see if the image already exists in the gallery, and if not then add it or update it, is there an easy approach without running several queries all at once.

Link to comment
Share on other sites

i'm hacing some issues when linkin two tables together, and i'm not getting the results that i want... like sometimes i get the same result over again for the number of times there is something in the one table....

two tables

table 1 has 3 colums, ID, Image_ID, Gallery_ID

table 2 has bunch of columsb main colum to focus on is image_id,

see what i want to happen is i want it to list all the pictures that appear in lets say Gallery_ID = 2, i can get this querry to work PERFECTLY, but i aslo want to be able to display which pictures DO NOT appear in Gallery_ID = 2, but this i can't get to work for the love of god, and then i aslo want it to show me which pictures do appear in the gallery adn which do not appear in the gallery, but on this querry i get a whole bunch of stuff doubled up

Link to comment
Share on other sites

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.