title: PHP variable not working in SQL query?
body: <pre><code>echo $date1u
  </code></pre>
  
  <p>Gives me 2010-04-21</p>
  
  <p>When I take that date and hardcode it into an SQL query it works fine </p>
  
  <pre><code>SELECT * FROM phoneappdetail WHERE salebarn = 'OSI' AND saledate = '2010-04-21'
  </code></pre>
  
  <p>But when I instead use the $date1u directly it doesn't work at all.</p>
  
  <pre><code>"SELECT * FROM phoneappdetail WHERE salebarn = 'OSI' AND saledate = '".$date1u."' "
  </code></pre>
  
  <p>What is the problem with my variable $date1u or SQL format that is stopping this from working?</p>
  
  <p><em>EDIT</em></p>
  
  <p>Followed a suggestion and tried</p>
  
  <pre><code>$result1 = "SELECT * FROM phoneappdetail WHERE salebarn = 'OSI' AND saledate = '".$date1u."' ";
  echo $result1;
  </code></pre>
  
  <p>To see the result and some how in this situation the out put is </p>
  
  <pre><code> SELECT * FROM phoneappdetail WHERE salebarn = 'OSI' AND saledate = '2010-04-22'
  </code></pre>
  
  <p>Some how when I echo $date1u alone its 2010-04-21 but when I echo the var in the SQL query 1 day got added</p>