How to access database table with drupal 7
If you have an autoincrement value for the primary key on the table you are inserting, then the execute() function will return you this increment value. So just check what it is returning.
But do make sure the value is defined as an autoincrement (defined as serial in hook_schema) because otherwise the returned value should not be used as it is undefined.

$nid = db_insert('node')
  -&gt;fields(array(
    'title' =&gt; 'This is only a test.',
    'uid' =&gt; 1,
    'created' =&gt; time(),
  ))
  -&gt;execute();
// This will ouput the $nid value to Drupal log.
 watchdog('yourmodule', "The value for nid is $nid .");