Jump to content

Archived

This topic is now archived and is closed to further replies.

chillexistence

Help with Complex Code Merging & Liking Tables

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.