• 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_name

    Collumns:
    ip varchar 20 “do not allow null”
    tanggal date “do not allow null”
    hits int 10
    online varchar 255

    https://www.ads-software.com/plugins/mechanic-visitor-counter/

Viewing 1 replies (of 1 total)
  • help im created mySQL table not work

    still warning
    Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in \mechanic-visitor-counter\wp-statsmechanic.php on line 149

Viewing 1 replies (of 1 total)
  • The topic ‘Manually Creating My_SQL Tables’ is closed to new replies.