title: PHP bind_params with null
body: <p>I am trying to bind params to a INSERT INTO MySQLi prepared statement if that variable exists, otherwise insert null.</p>
  
  <p>This is what I have, but it is not working:</p>
  
  <pre><code>if (!empty($name)) {
      $result-&gt;bind_param('ss', $name, $url_friendly_name);
  } else {
      $result-&gt;bind_param('ss', null, null);
  }
  
  if (!empty($description)) {
      $result-&gt;bind_param('s', $description);
  } else {
      $result-&gt;bind_param('s', null);
  }
  </code></pre>
  
  <p>Does anyone know of a better way of doing this or is there just a minor issue with my code. I am doing the above for each variable in the prepared statement.</p>