Wordpress Plugin Creating Database Tables

mattgenton

New Member
I am currently working on a plugin for personal use, but I just can't get the plugin to create a table, I try activation the plugin but it doesn't create a table here is my code:team-monobattle-registraion.php:\[code\]<?php/*Plugin Name: Team Monobattle RegistrationPlugin URI: http://www.web-geeks.com/Description: Plugin for registering teams for monobattles.Author: Web-geeksVersion: 1.0Author URI: http://www.web-geeks.com/*/function tmbr_admin() { include('team-monobattle-admin.php');}function tmbr_admin_actions() { add_options_page('Team Monobattle Registration', 'Team Monobattle Registration', 'manage_options', 'tmbr', 'tmbr_admin');}add_action('admin_menu', 'tmbr_admin_actions');include('team-monobattle-database.php');register_activation_hook(__FILE__, 'tmbr_install');?>\[/code\]team-monobattle-database.php:\[code\]<?phpglobal $tmbr_db_table_version;require_once(ABSPATH . 'wp-admin/includes/upgrade.php');$tmbr_db_table_version = "1.0";global $wpdb;function tmbr_install(){ global $tmbr_db_table_version; $installed_ver = get_option( "tmbr_db_table_version" ); if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != 'wp_teammonobattleteams' || $installed_ver != $tmbr_db_table_version ) { $sql = "CREATE TABLE wp_teammonobattleteams ( teamid mediumint(9) NOT NULL AUTO_INCREMENT, teamname tinytext NOT NULL, pname1 tinytext NOT NULL, pid1 smallint NOT NULL, pname2 tinytext NOT NULL, pid2 smallint NOT NULL, pname3 tinytext NOT NULL, pid3 smallint NOT NULL, pname4 tinytext NOT NULL, pid4 smallint NOT NULL, UNIQUE KEY id (id) );"; dbDelta($sql); echo('installed'); }}?>\[/code\]team-monobattle-admin.php:\[code\]<div class="wrap"><?php echo "<h2>" . __( 'Team Monobattle Admin', 'tmbr_admin' ) . "</h2>"; ?></div>\[/code\]Help appreciated,Techy
 
Top