Search code examples
mysqlsqldatabasedrupaldrupal-7

Where is the fault in the above code?


$status = db_insert('errors', 'e')
      ->fields('e', array('status' => 'correct',))
      ->execute();

Why these lines of code do not insert values in the status column??


Solution

  • Use this:

    $status = db_insert('errors')
    ->fields(array(
      'status' => 'correct'
    ))
    ->execute();