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?>
1function myplugin_update_db_check() {
2 global $jal_db_version;
3 if ( get_site_option( 'jal_db_version' ) != $jal_db_version ) {
4 jal_install();
5 }
6}
7add_action( 'plugins_loaded', 'myplugin_update_db_check' );
8
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}
18function inseruser()
19{global $wpdb;
20$table_name = $wpdb->prefix . "wpactable";
21$wpdb->insert('wp_wpactable',
22array('name'=>$name,
23'email'=>$email,
24'number'=>$number,
25'Website'=>$Website),
26array('%s','%s'));
27register_activation_hook(__FILE__, 'table_create' );
28register_activation_hook(__FILE__, 'inseruser' );
29?>
30