0

Hi I've wrote a plugin it works but on deactivation it doesn't drop the plugin tables from db
this is the code

$sql = "DROP TABLE IF_EXISTS 'TABLENAME'";
                $wpdb->query($sql);
                //$e = $wpdb->query($sql);
                //die(var_dump($e));

and i call that function this way
register_deactivation_hook(FILE, 'deactivate');

if i uncomment to show message error it tells me on deativation

bool(false)

whiy doesn't it drop the table?? could you help me to fix it??
thank you

Edited by JorgeM: replace wp_3DGridFX_portfolio with generic term, 'TABLENAME' as requested.

2
Contributors
3
Replies
17
Views
3 Years
Discussion Span
Last Post by Tpojka
0

with this code it worked!!

global $wpdb;   //required global declaration of WP variable

    $table_name = $wpdb->prefix.$table_name;

    $sql = "DROP TABLE ". $table_name;

    $wpdb->query($sql);

thank you!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.