title: PHP - convert string empty to null
body: <p>I have a php page when get the values from $_GET variables and put this in a php query with two condition:</p>
  
  <pre><code>AND book_id = '$bookid"
  AND book_date between coalesce('$bookdate',book_date) AND coalesce('$bookdate',book_date)
  </code></pre>
  
  <p>The problem is this condition: <code>AND book_date between coalesce('$bookdate',book_date) AND coalesce('$bookdate',book_date)</code>
  To work, the query want '$bookdate' = null, and when retrieve the variables, set the value as a string.</p>
  
  <p>How to make this?</p>
  
  <p>Thanks</p>