I am very new to PHP and am trying to find the best solution to my problem. In my database I have a field “painters”. Within painters I have “painter A”, “Painter B”,and “Painter C”. Is their a way to display painter c if certain art work comes up? Or Painter “B”, if a certain art work comes up? I am trying to understand the best way to do something like this dynamically. Any links, code, or tutorials would help me tremendously!
Thanks so much in advance!
-Mike
You are going to want 3 tables. A “Painters” table, a “assoc” table, and a “Painting” table.
Painters table includes:
Painting table includes:
Assoc table links them… It looks like:
So you can say SELECT PAINTING_ID FROM ‘ASSOC’ WHERE PAINTER_ID = ‘$Your_variable’
Then with that result set iterate through that array with a foreach.
Inside that foreach: you will
SELECT * FROM PAINTINGS WHERE ID = Array[‘PAINTING_ID’].
That’s a basic associative relational database.
You can google more about it, but that’s the basics that should get you started