title: how to make a variable select all when querying a database
body: <p>Hey all im trying to query a database using if if/else statement and I want one option to select all results from a specific column in the database (in this case location) an the other option to only select items based on form input:</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['indexSearchSubmit']))
  {
      if ($_POST['locationList']=='allLocations')
          {
              $selectedLocations = '*';
          }
      else
          {
              $selectedLocations = $_POST['locationList'];                
          }
  
      foreach($_POST['industryList'] as $selected)
          {
              $selectedIndustries = $selected;
  
              $result = mysqli_query($con,"SELECT * FROM currentListings WHERE location = '$selectedLocations' AND industry = '$selectedIndustries'");
  
              while($row = mysqli_fetch_array($result))
                  {
                      echo $row['industry'];
                      echo "&lt;br&gt;";
                      echo $row['location'];
                      echo "&lt;br&gt;";
                  }
          }
      mysqli_close($con);
  }
  </code></pre>
  
  <p>?></p>
  
  <p>The bit im confused about is the selectedlocation ='' im unsure what to put in in order for it to return all results.</p>
  
  <p>any help would be really appreciated</p>