title: Multiple where conditions in select query
body: <p>I am coding a small project and part of it involves creating a MySQL query based on user input.  The user has a lot of options to select from to build the dynamic query to the database.  I have been searching like mad to find any existing answers to my question, but they all seem to be different issues than what I am having.</p>
  
  <p>Options a user can specify that modify the query:</p>
  
  <ul>
  <li>IP address (they can enter a whole IP or partial and it will search the whole range)
  <li> Type (type 1 / type 2)
  <li>Status (active / inactive)
  <li>Carrier
  </ul>
  
  <p>The select query will change depending on if they have any of the above options select. If they choose both Types then it does not need to specify a type condition, likewise if both status are select it does not need to use the status as a condition.  If a user inputs an IP, it should search for the IP address, and if they input a carrier it should search for that carrier.</p>
  
  <p>I am trying to use PDO and Prepare statements to do this, but I am wondering how I can set up the prepare and execute statements with PDO, while having so many potential options (if they select only one type and one status, or both types and one carrier, etc).</p>
  
  <p>Is there any existing PDO functions/methods that will make this easier? Or will I need to create a bunch of if/else statements to check each option and append a $sql statement variable?</p>