[MySQL+PHP] SELECT -> Ignore condition if zero rows?
Posted on 2011-03-04
I have this example mysql_query:
mysql_query("SELECT * FROM table WHERE id='$id' AND name NOT IN($names)");
Is there any option in mysql_query to get results even if this returns Zero rows, i.e. run query ignoring that second condition?
I know it's easy to use PHP if() but I'm just curious whether is possible to do it inside one mysql_query.
Thanks for ideas!