I'm trying to learn how to create and use custom tables on wpdb for a plugin that I'm going to build. So far I've seen a bunch of tutorials and know how to create a table but I'm facing problems storing data and debugging my table.
so for my plugin I've created a main class where these functions are called
public function pre_install(){
global $wpdb;
global $pre_db_version;
$pre_db_version='1.1';
$table_name = $wpdb->prefix . 'prelauncher';
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
username tinytext NOT NULL,
email varchar(255) NOT NULL,
UNIQUE KEY id (id)
) $charset_collate;";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $sql );
add_option( 'pre_db_version', $pre_db_version );
}
and then outside the class I called
register_activation_hook( __FILE__, array('main_class','pre_install'));
This should create a database table called wp_prelauncher with two columns, username and email which it does but it also creates two extra columns called my_title and show_title . Where are these two columns coming from I have no idea. I have searched my entire code but found nothing.
Also if anyone could point me in the direction where I could learn how to save user input in this table it will be a big help.