This will return all rows from table gallery wher gallery_id is $gallery, artist_name ist $artitstname and image_name is $imgname.
But it seems like this is not what you want.
I've asked before how you want your conditions, but you did not gave me a useful answer so I can only guess:
[sql]
SELECT * FROM gallery WHERE (gallery_id = '$gallery' AND '$artistname'='' AND '$imgname'='') OR (gallery_id='$gallery' AND artist_name='$artistname' AND image_name='$imgname')
[/sql]
This will return all rows table gallery wher gallery ID is $gallery, artist_name ist $artitstname and image_name is $imgname, or all rows from table gallery where gallery ID is $gallery and $artistname, $imgname are empty.
A better way would be to construct your query in PHP so it does only contain conditions for columns you really care for.
|