title: PHP code can UPDATE MySQL database, but can't INSERT
body: <p>My update of the database has no problems whatsoever.  And down in my local development environment a new record insert also has no problems. I have tried changing my MySQL user many times because I thought it might be about permissions (maybe that is still the problem, I don't know). I have even made the user root and supplied my correct root password: again, I can perform updates, but no new record inserts. Here is my code which I have shortened (i.e taken out the large number of fields. It works locally, but not on the server).</p>
  
  <p>I am on Ubuntu Linux, 16.04, PHP 7</p>
  
  <pre><code>$message = '';
  
  $db = new mysqli('localhost', 'root', 'notrealpword', 'mydatabase');
  
  
  if ($db-&gt;connect_error){
  
    $message = $db-&gt;connect_error;
  
  }else{
  
  //    echo $message ;
  
  }
  
  $prep = $db-&gt;prepare("INSERT INTO users (userid, username) VALUES 
  ('0',?)");
  //Now, you can bind some parameters.
  $prep-&gt;bind_param('s',$username);
  
  $username = "atservertest";
  
  
  $prep-&gt;execute();
  
  $numaffected = $prep-&gt;affected_rows ;
  
  echo $numaffected;
  
  //        echo $numaffected . " row(s) affected." ;
  
  $prep-&gt;close();
  </code></pre>