I am doing a search form in which I want to be able to pull results up from 6 different tables. They will then be displayed in there own sections.
Names of Artist(s)
- Amedeo Modigliani, 1884 - 1920, Italian
- Amedeo Preziosi, 1816 - 1882, Italian
Titles
- A Blond Woman. (Portrait of Germaine Survage), 1918
- Adam, 1915-16
- Adrienne (Woman with Bangs), 1917
- Almaisa, the Algerian Woman, 1917
Movements
- Impressionism
- Action Painting
etc.
I thought that I might be able to do 6 different queries and then echo out the results but not sure how I would call them.
In my head it works like this
$artist = mysql_query("SELECT * FROM artist WHERE fullName LIKE '%$search%' ORDER BY lastName");
$image = mysql_query("SELECT image.imgid, image.title, image.artid, image.keywords, image.dt, artist.artid, artist.fullName FROM image LEFT JOIN artist ON artist.artid = image.artid WHERE image.title LIKE '%$search%' ORDER BY title") or die(mysql_error());
//Would do a query on each table
if ($num_artist != "0")
do this
andif($num_image != "0")
do this
//etc...
All of my queries will have JOINS but can I join 6 tables together and then call the results?
Can someone lead me in the direction for this?
I was playing around and it looks like I can just use a buch of IF statements - would that be the best route to take?