<?php
-require_once('../wp-config.php');
+$wp_only_load_config = true;
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
$debug = 0;
/**
** Returns: true if already exists or on successful completion
** false on error
*/
+if ( ! function_exists('maybe_create_table') ) :
function maybe_create_table($table_name, $create_ddl) {
global $wpdb;
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
}
}
//didn't find it try to create it.
- $q = $wpdb->query($create_ddl);
+ $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
if ($table == $table_name) {
}
return false;
}
+endif;
/**
** maybe_add_column()
** Returns: true if already exists or on successful completion
** false on error
*/
+if ( ! function_exists('maybe_add_column') ) :
function maybe_add_column($table_name, $column_name, $create_ddl) {
global $wpdb, $debug;
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
}
}
//didn't find it try to create it.
- $q = $wpdb->query($create_ddl);
+ $wpdb->query($create_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
}
return false;
}
-
+endif;
/**
** maybe_drop_column()
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
//found it try to drop it.
- $q = $wpdb->query($drop_ddl);
+ $wpdb->query($drop_ddl);
// we cannot directly tell that whether this succeeded!
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
if ($column == $column_name) {
}
echo "</pre>";
*/
-?>
\ No newline at end of file
+?>