• Answers
  • Web
Personalize Yedda, (And make Danny Happy)
People ask & answer about almost everything. Tell us what you're interested in... So we can personalize Yedda especially for you
I'm interested in:

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);
}


Share Send to a friend Watch Report
 
 

Posted Answers

No answers were posted yet - be the first one to answer!

Sign in to participate

Got an answer for myed? Would you like to comment on the posted answers, or vote for the one which you think is the best?

Sign up for a free account, or sign in (if you're already a member).

Explore Related Questions

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


Q:

Steps to start prototyping using php and mySQL

Many people recommended to try prototyping using php and mySQL server and even more asked how to start with it What is needed ...
Submitted by MikeBeer   3 years ago.
  • viewed 379 times
Last answer posted 3 years ago by MikeBeer


Q:

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

Can you connect to two mysql databases on one php page?
Submitted by myed   1 year ago.
  • viewed 552 times


Q:

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 ...
Submitted by hyma   1 year ago.
  • viewed 80 times



» More...

Feed - Subscribe to changes to this Q&A Blog
ADVERTISEMENT
  • Answers
  • Web
Copyright © 2006-2009, Yedda Inc. and respective copyright owners · CC License