dbDelta
Useful for creating new tables and updating existing tables to a new structure. Run multiple query at the same time.
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$sql = "CREATE TABLE tes (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
PRIMARY KEY (id),
) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
dbDelta( $sql );
Last updated