title: insert statement not writing to db file in sqlite 3?
body: <p>I'm trying to write data from a simple form to an SQLite database, but even though I'm committing the transactions, nothing is written to the database file. This is the php code:</p>
  
  <pre><code>$expense = new Model();
  $expense-&gt;add_expense($_POST);
  </code></pre>
  
  <p>and in the Model class:</p>
  
  <pre><code>class Model {
  
      private $database = 'expenses.db';
      private $dbh;
  
      function __construct() {
          $this-&gt;dbh = new PDO('sqlite:/var/www/expenses/' . $this-&gt;database);
          $this-&gt;dbh-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      }
  
      public function add_expense($args) {
          $stmt = $this-&gt;dbh-&gt;prepare('INSERT INTO `expenses` (`type`, `name`, `location`, `receipt_date`, `price`, `notes`) VALUES (?, ?, ?, ?, ?, ?)');
          $this-&gt;dbh-&gt;beginTransaction();
          $stmt-&gt;execute(array_values($args));
          $this-&gt;dbh-&gt;commit();     
      }
  }
  </code></pre>
  
  <p>This is the contents of <code>$args</code>, from inside the function:</p>
  
  <pre><code>Array
  (
      [type] =&gt; type
      [name] =&gt; item_name
      [location] =&gt; place
      [date] =&gt; 1313180040
      [price] =&gt; 8.86
      [notes] =&gt; none
  )
  </code></pre>
  
  <p>Also, <code>$stmt-&gt;getMessage();</code> doesn't output anything. This is the SQL to create the table:</p>
  
  <pre><code>BEGIN TRANSACTION;
  CREATE TABLE expenses (notes TEXT, type TEXT, location TEXT, name TEXT, price NUMERIC, receipt_date NUMERIC);
  COMMIT;
  </code></pre>
  
  <p>Validation isn't relevant, so I left it out. The contents of <code>$args</code> that I listed is after validation occurs, and it's all correct. </p>
  
  <p>UPDATE: Same code but using bindParam and named parameters instead:</p>
  
  <pre><code>$stmt = $this-&gt;dbh-&gt;prepare('INSERT INTO `expenses` (`type`, `name`, `location`, `receipt_date`, `price`, `notes`) VALUES (:type, :name, :location, :receipt_date, :price, :notes)');
  </code></pre>
  
  <p>and the binding statements:</p>
  
  <pre><code>$stmt-&gt;bindParam(':type', $args['type']);
  $stmt-&gt;bindParam(':name', $args['name']);
  $stmt-&gt;bindParam(':location', $args['location']);
  $stmt-&gt;bindParam(':receipt_date', $args['date']);
  $stmt-&gt;bindParam(':price', $args['price']);
  $stmt-&gt;bindParam(':notes', $args['notes']);
  $stmt-&gt;execute();
  </code></pre>
  
  <p>Still, nothing happens. </p>