I guess, you can use the following function
public function pre_install() {
global $wpdb;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
$sql="
CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."prelauncher`
(
id mediumint(9) NOT NULL auto_increment,
username tinytext NOT NULL,
email varchar(255) NOT NULL,
PRIMARY KEY (`main_id`)
);";
dbDelta($sql);
}
and than your activation hook.
register_activation_hook( __FILE__, array('main_class','pre_install'));
I dont think the $pre_db_versions – required for the this table creation.
I hope this will solve your problem.
Related Posts:
- Create custom column in post table in wordpress
- Should I global $wpdb outside of any of my plugin’s functions scope?
- The plugin generated x characters of unexpected output, $wpdb not defined
- DROP TABLE with uninstall hook not working
- Create a table with wordpress plugin boilerplate
- Multiple instance of data in plugin custom database table on plugin activation
- Can I create a table on my DB without creating a plugin?
- Creating a search form and displaying results
- create pages automatically and dynamically in wordPress
- $wpdb->delete not working for me
- I want to schedule email (date, time is in database->table) wp_schedule_event() not working
- Show a table from data submitted by a form from a user
- Delete tables from database when deleting plugin
- How to delete all records from or empty a custom database table?
- WordPress sharding: which multi-DB plugin to use?
- How to make sense of the active_plugins option_value to enable and disable certain plugins from the database?
- Simple form that saves to database
- Using Vagrant for customizable WordPress Multi-sites [closed]
- Updating WordPress – the best approach (updating wp core, plugins and db)
- How do I check what plugins are enabled via the database?
- How can a Firebase user registration and login be integrated into a WordPress site?
- How to update widget_text in the wp_options table
- prefix table and plugins
- how to show database content in wordpress post
- What is the easiest way to implement cascading database upgrade for my plugin?
- Storing Email Account Passwords for SMTP Mailing for a WordPress Plugin
- Remove obsolete plugins artifacts from database tables
- If I delete plugins via FTP are settings kept in DB?
- What kind of data is that?
- Cannot login to ADMIN even after changing password in phpmyadmin
- Embed a Google Sheet as you view it in a separate tab?
- Where does WordPress store plugin (enabled/disabled) status for multisite?
- How to access data in wordpress database externally using php
- custom user tables supported in SharDB plugin?
- How to check if tables in WordPress still exists after activations
- Prevent duplicate records in plugin table
- Automatic switch to backup database on fail
- WordPress Integration with Google Groups
- wp_editor content in plugin options page
- Why this function not working for install database on plugin activation
- WordPress : Explain Plugins & Theme string value in database
- Plugins in WP_Options but not Active
- WordPress as a data-store?
- Issue running db create table query from static method
- Problem of encoding characters (apostrophes) in my posts publications
- Is there a rule for wordpress plugins developers to not do any database changes upon update?
- Updating options into the wp database performance
- Ajax save data to database on document ready, no data being saved
- How to edit a published post?
- External wpdb connections in different plugins on single page
- Comment “like” problem – “users who like this” avatar linking to current user profile instead of “liker’s” profile
- WordPress plugin boilerplate table create
- Table is not created in WAMP
- How to relate 3 wordpress components with each other (Create database relationships)
- How can I store data from custom fields to custom tables?
- Interface needed to transfer contents in a table on a web page to the Add New Product interface
- Integrating Custom Database with WordPress
- How to display results from a data table with an encrypted user id?
- add_action for publish_post doesn’t work
- Getting URL GET parameter with Code snippets and storing it in database?
- Same Plugin tables between wordpress installations
- Is classical wordpress eidtor a good option for me to include a large table with a large number of images on my webpage?
- A dynamic table plugin to get user input
- Optimise wordpress database using SQL after deleting registered images from Media Folder
- How to implement data residency in my WordPress site
- add_action(‘the_content’, ‘my_plugin_content’) is null
- WordPress database problem wp_posts, primary key
- How to allow URL with filename & extension in wordpress?
- Programmatically generate new pages for a site based on page template and content elements accessed via DB
- How wordpress handle urls present in db for external wp-content directory
- Using Filters to modify contect – DB query results alwats appear fist
- PHP message: WordPress database error Deadlock found when trying to get lock
- Many to many relationship for variable products
- Is it a good practice to use wordpress database to store pages contents which loading to page dynamically?
- using wordpress login details for other website / application / forum?
- Where do the section input fields values are stored in database
- how to create database to use it in wordpress website?
- how can i get records from wp_postmeta table using particular meta_key in database?
- How to create a custom page for unrelated database?
- User content database [closed]
- Include plugin form in the home page
- Write mysql credentials in plugin
- Is saving multiple options or saving multiple items in one option better?
- Collaborate on wordpress local website, share files via dropbox?
- Pull Data from DB for Admin Page Display as Relates to Admin Page Class by BA Internet
- Posts are deleted everyday at night
- How to find an option in the database?
- Carrying information from button click into form [closed]
- Is there a plugin that will override the “Error establishing a database connection” message? [closed]
- Get the url of attachments from the post?
- Create New Admin Menu Section – Like how custom post type works, in a way
- Shortcode returning specific content of a post
- get_option returning a different value from what’s saved
- Identifying Plugins Based on Tables [closed]
- How can I delete the options from DB when the plugin is deleted?
- register_activation_hook not working
- Does anyone recognize these table names?
- Edit a page/post DB data?
- plugin doesn’t retrieve data from database
- How to create specific wordpress Table