title: Check if SQL INSERT was successful
body: <p>I am currently learning <code>PHP</code> and am using the query below to insert values into my MySQL table.<br>
  I would like to check whether or not the values were inserted correctly. I have tried writing an IF statement and have searched through numerous examples, none of which seem to be working. </p>
  
  <p>I would appreciate any help in steering me in the right direction.</p>
  
  <pre class="lang-php prettyprint-override"><code>$dd_tracking_insert = $dd_tracking_conn-&gt;query("INSERT INTO $dd_tracking_table_name (invoice_id, user_id, gc_bill_id, gc_bill_amount, gc_bill_fees, gc_bill_status, gc_bill_created) VALUES ('$invoice_id', '$user_id', '$gc_transaction_id', '$invoice_amount', '$gc_fees', '$gc_status', now())");
  </code></pre>
  
  <p>IF inserted correctly - <code>echo "inserted"</code>.<br>
  If Error: was not inserted -<code>echo "error: values where not inserted correctly."</code></p>
  
  <p>Link to full code <a href="http://pastie.org/private/j7i5e0ybzexjjv5lalmmw" rel="nofollow">here</a></p>