Trying To Create New Wordpress Database Table
Try this code
register_activation_hook ( __FILE__, 'on_activate' );
function on_activate() {
global $wpdb;
$create_table_query = "
CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}table1` (
`id` bigint(20) unsigned NOT NULL default '0',
`name` text NOT NULL,
`address` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
";
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta( $create_table_query );
}
Your create table syntax is wrong, should be:
$sql = 'CREAT TABLE '.$table_name.'(
-----
$sql = 'CREATE TABLE '.$table_name.'(
Edit: Define your primary key
$sql = 'CREATE TABLE '.$table_name.'(
id INTEGER NOT NULL,
thumbs_max VARCHAR(3),
image_max VARCHAR(4),
image_quality VARCHAR(3),
PRIMARY KEY (id))';
Bit of extra info on SQL from W3schools: http://www.w3schools.com/sql/sql_primarykey.asp