Truncating a table (1 post)

  1. Arnan de Gans
    Posted 9 years ago #

    hi there,

    Im working on a small plugin and want to buildin a function to truncate it's table.

    Currently im struggling with this code:

    if($user_level >= 10) {
    $deletequery = "TRUNCATE TABLE ".$table_prefix."winamp";
    if(!$wpdb->query($deletequery)) {
    } else {
    header('Location: options-general.php?page=wp_winamp/wp-winamp.php&cleared=true');

    But somehow this always results in a error.
    I did not manage to get mysql_error() to output something i guess it gets somewhere outputted before i call it and therefor cannot see it.

    When i add echo 'error'; above the line where die() is in. I get error. So something is wrong.

    When i replace the wordpress query function for mysql_query() it does work with no trouble.

    I wordpress limited in its use of Truncate? I always thought i could feed it any query i like.

    Many thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic