title: export csv with current date and time as filename
body: <p>I am trying to use php to put SQL results into a .csv file where the file name will be the current date and time.</p>
  
  <p>The search query below works if I insert a unique filename manually, but when I try to concatenate the <code>$date</code> variable as below, I get a mysql syntax error in terminal.</p>
  
  <pre><code>$date = date('Y-m-d h:i:s')
  $query_text = "SELECT Code FROM Country WHERE HeadOfState = 'Big Bird' INTO OUTFILE '/tmp/' . $date . '.csv'";
  
  $result = mysql_query($query_text);
  </code></pre>
  
  <p>This seems logical to me from the context of PHP, but SQL doesn't seem to like it.</p>
  
  <p>Any help is greatly appreciated.
  Thanks.</p>