![]() |
grabbing results even though some WHERE's are false
ok basically im writing a searching script but when i dont type in an image name, an artist name,but i type in a gallery id it says there are none cause its selecting with image name and artist name being nothing. is there a away around this so it will just select everything with that gallery id even though image name and artist name are set to nothing?
|
Or :)
|
but i still want to if like artist name has some value that it will also refine the results from gallery id and remove those results which arent equal to artist name
|
OK, so let's figure out what you want ;)
If I am right we're talking about 3 fields: Image Name, Artist Name and Gallery ID. Pleasse tell me what you want to have returned in each of the following cases:
|
in all those cases i want all the data in my gallery table to be returned which matches the criteria in WHERE
|
Yeah ;)
And what IS the criteria? |
Can you post the query or the code for us to see? Would help solve the problem.
|
PHP Code:
|
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. |
ok i see how it will work;)
did you see mess up on the first one? '$imgname'='' ? |
All times are GMT. The time now is 07:20 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|