1

So I am busy creating a plugin that creates a custom table to read in some data. The plugin works 100% on localhost but does not create the table in the db on the real host. I have debug enables and there does not seem to be a problem. I have tried query but no luck

On localhost the wordpress installation is in the root file but on the server the wordpress installation is in a folder called v in the root file. (might make a difference?)

The basic code is

function elite_fuel_installl() {
 global $wpdb;
 $table_name = $wpdb->prefix . "test";
 $sql = "CREATE TABLE $table_name (
 id mediumint(9) NOT NULL AUTO_INCREMENT,
 timeDataCollected datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
 ULP93Inland text NOT NULL,
 ULP95Inland text NOT NULL,
 ULP93Coastal text NOT NULL,
 ULP95Coastal text NOT NULL,
 Diesel005 text NOT NULL,
 Diesel0005 text NOT NULL,
 UNIQUE KEY id (id)
 );";


 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
 dbDelta( $sql );


 $rows_affected = $wpdb->replace( $table_name, array
 ( 'id' => $idd, 'timeDataCollected' => current_time('mysql'),
 'ULP93Inland' => $ULP93Inland, 'ULP95Inland' => $ULP95Inland,
 'ULP93Coastal' => $ULP93Coastal,'ULP95Coastal' => $ULP95Coastal,
 'Diesel005' => $Diesel005,'Diesel0005' => $Diesel0005) );
}


register_activation_hook( __FILE__, 'elite_fuel_installl' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.