-
Notifications
You must be signed in to change notification settings - Fork 56
scbTable
scribu edited this page Apr 18, 2012
·
7 revisions
To initialize:
<?php
require dirname(__FILE__) . '/scb/load.php';
scb_init( 'my_plugin_init' );
function my_plugin_init() {
new scbTable( 'example', __FILE__, "
example_id int(20),
example varchar(100),
PRIMARY KEY (example_id)
");
}This will take care of creating the table upon plugin activation (or upgrading it if it already exists) and uninstalling it when the plugin is deleted.
It also sets $wpdb->example = $wpdb->prefix . 'example'; as a convenience, when doing custom queries:
<?php
$wpdb->get_results( "SELECT * FROM $wpdb->example" );