Title: Manually Creating My_SQL Tables
Last modified: August 21, 2016

---

# Manually Creating My_SQL Tables

 *  [comziz](https://wordpress.org/support/users/comziz/)
 * (@comziz)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/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_name
 * **Collumns:**
    ip _varchar_ 20 “do not allow null” tanggal _date_ “do not allow
   null” hits _int_ 10 online_ varchar_ 255
 * [http://wordpress.org/plugins/mechanic-visitor-counter/](http://wordpress.org/plugins/mechanic-visitor-counter/)

Viewing 1 replies (of 1 total)

 *  [morrismn](https://wordpress.org/support/users/morrismn/)
 * (@morrismn)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/manually-creating-my_sql-tables/#post-4450081)
 * 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.

 * ![](https://s.w.org/plugins/geopattern-icon/mechanic-visitor-counter.svg)
 * [Mechanic Visitor Counter](https://wordpress.org/plugins/mechanic-visitor-counter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mechanic-visitor-counter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mechanic-visitor-counter/)
 * [Active Topics](https://wordpress.org/support/plugin/mechanic-visitor-counter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mechanic-visitor-counter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mechanic-visitor-counter/reviews/)

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [manually](https://wordpress.org/support/topic-tag/manually/)
 * [table](https://wordpress.org/support/topic-tag/table/)

 * 1 reply
 * 2 participants
 * Last reply from: [morrismn](https://wordpress.org/support/users/morrismn/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/manually-creating-my_sql-tables/#post-4450081)
 * Status: not resolved