title: PHP - Write To MySQL Database
body: <p>I'm simply writing some values to a MySQL database using the following snippets of code.</p>
  
  <p>Please note, when I run <strong>SELECT</strong> queries, information is correctly displayed using echo etc.</p>
  
  <p>However when I try to write to the database using <strong>INSERT</strong>, the code executes with no errors, but when I check my database there is nothing written to it.</p>
  
  <pre><code> private $db;
  
   function __construct() {
   $this-&gt;db = new mysqli('localhost', 'xyz', '123', 'testdb');
   $this-&gt;db-&gt;autocommit(FALSE);
  
  if (isset($_POST["ID"]) &amp;&amp; isset($_POST["Number"]) &amp;&amp; isset($_POST["Address"]) &amp;&amp; isset($_POST["Ticket"])) {
  
  $id= $_POST["ID"];
  $number= $_POST["Number"];
  $address= $_POST["Address"];
  $ticket= $_POST["Ticket"];
  
  $stmt = $this-&gt;db-&gt;prepare("INSERT INTO tickets (ID, Number, Address, Ticket) VALUES (?,?,?,?)");
  $stmt-&gt;bind_param("iiss", $id, $number, $address, $ticket);
  $stmt-&gt;execute(); 
  $stmt-&gt;close()
  
  return true
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Question - Could it be something to do with write access to the database? I've checked the user account privileges and it has all privileges.</p>