• <?php
    function createTables(){
             global $wpdb;
            $sql = "create table wp_mainMenu(
               mainMenuId int not null auto_increment primary key,
               title varchar(50),
               showAccordion bit,
               defaultOpen bit,
               priority int
            );# MySQL returned an empty result set (i.e. zero rows).
            create table wp_subMenu(
               subMenuId int not null auto_increment primary key,
               mainMenuId int,
               title varchar(50),
               priority int,
               foreign key(mainMenuId) references mainMenu(mainMenuId) on delete cascade on update cascade
            );
            ";
            require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
            dbDelta( $sql );
    
    }
    register_activation_hook(__FILE__, 'createTables');
  • The topic ‘why my tables did not create while activation?’ is closed to new replies.