Skip to content

mirzazeyrek/wordpress-multiple-insert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 

Repository files navigation

Wordpress Multiple Insert

A Wordpress method for inserting or updating multiple rows in a safer and faster way

usage example for insert:

       $insert_arrays = array();
       
       $time = current_time( 'mysql' );
       
       $insert_arrays[0] = array(
       'type' => "multiple_row_insert",
       'status' => 1,
       'name'=>"gordon freeman",
       'added_date' => $time,
       'last_update' => $time);
       
       $insert_arrays[1] = array(
       'type' => "multiple_row_insert",
       'status' => 2,
       'name'=>"captain dance",
       'added_date' => $time,
       'last_update' => $time);
       
       $insert_arrays[2] = array(
       'type' => "multiple_row_insert",
       'status' => 3,
       'name'=>"doc. emmet l. brown",
       'added_date' => $time,
       'last_update' => $time);
     
       wp_insert_rows($insert_arrays,$wp_table_name);

usage example for update:

   	wp_insert_rows($insert_arrays, $wpdb->tablename, true, "primary_column");

source : http://stackoverflow.com/a/12374838/1194797

About

a method for inserting multiple rows with in a safer and faster way

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages