Decaflon

Welcome to Decaflon! Where the geeks hang out: Signup or Login Here
Decaflon is proudly hosted by (mt) Media Temple.  We recommend them for your web hosting needs.
Clips: Popular Clips Upcoming Clips Notes: All Notes

I'm trying to write a plugin for WP, and I'm having lots of toruble creating the database. Can anyone help me troubleshoot this code?


$st_db_version = "0.1";
function st_install(){
global $wpdb;
global $st_db_version;
$table_name = $wpdb->prefix . "spinthat";
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
$sql = "CREATE TABLE " . $table_name . " (
st_id mediumint(9) NOT NULL AUTO_INCREMENT,
st_time bigint(11) DEFAULT '0' NOT NULL,
st_artist tinytext NOT NULL,
st_album tinytext NOT NULL,
st_rating mediumint(6) DEFAULT '0' NOT NULL,
st_blurb text NOT NULL,
st_img VARCHAR(100) NOT NULL,
st_url VARCHAR(100) NOT NULL,
PRIMARY KEY (st_id)
);";
require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
dbDelta($sql);
add_option("st_db_version", $st_db_version);
}
}
add_action('activate_plugindir/wp_spinthat.php', 'st_install');

Thanks!

You pulling any errors?

to be honest, I'm not sure how to check any logs- can I?

The plugin installs just fine, but the tables are never added..

Yeah I don't know what's going on, everytime I run over your code it looks legit.

well at least I'm not crazy.. thanks for takin a look!

Please Login To Leave A Comment

Decaflon Sponsors Get in touch if you want in.

Hot Notes (View all »)

 

Decaflon is part of the Chawlk Network of sites.

9 Great Places To Visit, Hang Out, & Meet New People

What's new and interesting at other Chawlk Network sites: