create table in wordpress plugin

Solutions on MaxInterview for create table in wordpress plugin by the best coders in the world

showing results for - "create table in wordpress plugin"
Elizabeth
07 Nov 2016
1<?php
2function table_create()
3{
4global $wpdb;
5$table_name = $wpdb->prefix . "wpactable"; 
6$charset_collate = $wpdb->get_charset_collate();
7 $sql = "CREATE TABLE IF NOT EXISTS $table_name (
8  id mediumint(9) NOT NULL AUTO_INCREMENT,
9  name tinytext NOT NULL,
10  email tinytext NOT NULL,
11  number tinytext NOT NULL,
12  Website text NOT NULL,
13  PRIMARY KEY  (id)
14) $charset_collate";
15require_once( ABSPATH .'wp-admin/includes/upgrade.php' );
16dbDelta( $sql );
17}
18
19?>