Manually Creating My_SQL Tables
-
global $wpdb;
define(‘BMW_TABLE_NAME’, $wpdb->prefix . ‘mech_statistik’);
define(‘BMW_PATH’, ABSPATH . ‘wp-content/plugins/mechanic-visitor-counter’);
require_once(ABSPATH . ‘wp-includes/pluggable.php’);function install(){
global $wpdb;
if ( $wpdb->get_var(‘SHOW TABLES LIKE “‘ . BMW_TABLE_NAME . ‘”‘) != BMW_TABLE_NAME )
{
$sql = “CREATE TABLE IF NOT EXISTS". BMW_TABLE_NAME . "
(“;
$sql .= “ip
varchar(20) NOT NULL default ”,”;
$sql .= “tanggal
date NOT NULL,”;
$sql .= “hits
int(10) NOT NULL default ‘1’,”;
$sql .= “online
varchar(255) NOT NULL,”;
$sql .= “PRIMARY KEY (ip
,tanggal
)”;
$sql .= “) ENGINE=MyISAM DEFAULT CHARSET=latin1;”;
$wpdb->query($sql);
}
}function uninstall(){
global $wpdb;
$sql = “DROP TABLE". BMW_TABLE_NAME . "
;”;
$wpdb->query($sql);
}I am willing to manually create this table on my-sql, but I would appreciate it very much if somebody could confirm the following structure is correct:
Table name:
mech_statistik_bmw_table_nameCollumns:
ip varchar 20 “do not allow null”
tanggal date “do not allow null”
hits int 10
online varchar 255https://www.ads-software.com/plugins/mechanic-visitor-counter/
- The topic ‘Manually Creating My_SQL Tables’ is closed to new replies.