title: How to filter out the where clause in a query builder?
body: <p>I'm building an dynamic application with a query builder that consists of four select lists where the user can enter the table, column, operator and attribute names. Now I also want the user to be able to do select ALL. So the user should have the option to only select the table, and column name(=ALL). But I don't know how to filter out the where clause then. This is my php script at the moment:</p>
  
  <pre><code>&lt;?php
  
  include "connect.php";
  
  $table          = $_GET['tableSelected'];
  $field          = $_GET['fieldSelected'];
  $attribute      = $_GET['attributeSelected'];
  $operator       = $_GET['operatorSelected'];
  $tableList      = $_GET['tableList'];
  $fieldList      = $_GET['fieldList'];
  $attributeList  = $_GET['attributeList'];
  
  $fieldstr = $fieldList . ",ST_AsGeoJSON(ST_Transform(l.geom,4326))";
  
  
  $sql = "SELECT $fieldstr
          FROM $table l
          WHERE $field $operator '{$attribute}'";
  
  if (!$response = pg_query($conn, $sql)) {
      echo "A query error occured.\n";
      exit;
  }
  
  while ($row = pg_fetch_row($response)) {
      foreach ($row as $i =&gt; $attr){
          echo $attr.", ";
      }
      echo ";";
  }
  
  ?&gt;
  </code></pre>