Can WHERE equal anything in a MySQL query?

I'm trying to create one function to do a lot of different sorting. Can I make the default value of a WHERE argument equal to anything? So that the default value for that argument will find everything?

function get_inventory ($order = 'id', $location = 'WA', $recalls = 'anything', $sold = '0') {
$query = "SELECT * FROM v_inventory ";
$query .= "WHERE location = '{$location}' and ";
$query .= "recalls = '{$recalls}' and ";
$query .= "sold = '{$sold}' ";
$query .= "ORDER BY {$order} ASC";
$result = mysql_query($query, $connection);
}

Liked this question? Tell your friends about it

Answers

No, because WHERE arguments gives a specific field to search the record from the table. In front end you can assign a variable for WHERE that you can search in everything record from table.

TeamCreatives proudly delivers professional and <a href="http://www.teamcreatives.com/" rel="nofollow">affordable web design services</a> and <a href="http://www.teamcreatives.com/services/seo.html" rel="nofollow">search engine optimization services</a> for your website needs.

Related Questions

Other people asked questions on similar topics, check out the answers they received:

Asked: Can you connect to two mysql databases on one php ...

Can you connect to two mysql databases on one php page?

Asked: How to store xml file in mysql when a button is ...

how to store xml file in mysql when a button is clicked using php ? how to get xml file from mysql when another button is clicked by php?

Asked: How do you map fields between two mysql databases ...

how do you map fields between two mysql databases (different web apps) using php? Preferably with a code example.