title: How to use a variable storing an equal sign in an SQL query
body: <p>I'm creating a search toolbar on my web page to allow the user to identify what column to search, and what operator to use to search that column. To avoid having a lot of if statements, I want to write the SQL like this:</p>
  
  <pre><code>if ($operator == "LIKE") {
      sql = "SELECT * FROM `mytable` WHERE `$column` '$operator' '%$search%'";
  } else {
      sql = "SELECT * FROM `mytable` WHERE `$column` '$operator' '$search'";
  } 
  </code></pre>
  
  <p>This works fine if the operator is LIKE, but when it is =, it doesn't work.  I've checked the array that is posted to the page, and have confirmed that the array is posting correctly.  How do I make this work when the operator is "=" ?  Here is the array:</p>
  
  <pre><code>Array
  (
      [column] =&gt; first_name
      [operator] =&gt; =
      [search] =&gt; paul
      [page_rows] =&gt; 10
  )
  </code></pre>