0

//create table
global $wpdb;
    $table = $wpdb->prefix . "contact_table"; 
    $charset_collate = $wpdb->get_charset_collate();
    $sql = "CREATE TABLE IF NOT EXISTS $table (
        `id` mediumint(9) NOT NULL AUTO_INCREMENT,
        `page_name` VARCHAR(500) NOT NULL,
        `title_name` VARCHAR(50) NULL,
        `full_name` VARCHAR(50)  NULL,
        `email` VARCHAR(50) NOT NULL,
        `phone` VARCHAR(50) NOT NULL,
        `home_select` VARCHAR(500)  NULL,
        `home_price` VARCHAR(500)  NULL,
        `selected_builder` VARCHAR(500)  NULL,
        `comment`  VARCHAR(500) NULL,
        `newsletter` VARCHAR(50)  NULL,
    UNIQUE (`id`)
    ) $charset_collate;";
    require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
    dbDelta( $sql );
//create table

Jagdish Sarma Asked question August 4, 2021
Add a Comment