Search code examples
drupal-7

How to process multi insertion into a table using single excution


Which is the best way to perform multi insertion into a table using custom code in drupal7.


Solution

  • $segment[] = array('name' => 'test)
    $query = db_insert(TABLE_NAME_SEGMENT);
    $query->fields( array('name') );
    foreach($segment as $value) 
    $query->values($value);
    $query->execute()
    

    finally,I got the solution for it.I don't whether it good or bad