title: PHP set a default value for database insert
body: <p>I have a number box <code>&lt;input type='number' step='any' name='number' id='number'&gt;</code></p>
  
  <p>and I take that value and call it in a function like so:</p>
  
  <p><code>insertIntoDB($number)</code></p>
  
  <pre><code>function insertIntoDB($number = null){
  
    //insert into db
    "INSERT INTO 'tablename' (number) VALUES " . $number;
  
  }
  </code></pre>
  
  <p>and I get this error:</p>
  
  <pre><code>Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' '
  </code></pre>
  
  <p>Is there away so if the user leaves the field blank it will enter the value as null?</p>