Cannot access newly created wordpress table

I have created a new table in the wordpress database via PhpMyAdmin. However I have not be able to write into any of the tables that I have created. Writing in the predefined tables such as metapost works just fine with the same code. When I write out the error it seems that wordpress believes that I "forgotten" to enter the table name, like wordpress is not aware that this new table exists. What is going on? The name of my table is hest

Here is my code:

    <?php
    $metakey   = 'THAT IS';
    $metavalue = 'DONE.';
     
    $wpdb->query(
    $wpdb->prepare(
    "
    INSERT INTO $wpdb->hest
    ( meta_key, meta_value )
    VALUES ( %s, %s)
    ",
    $metakey,
    $metavalue
    )
    );
    $wpdb->show_errors();           
    echo $wpdb->last_query;         
    ?>

Here is the show_error message: As you can see the table name is suddenly gone in the executed query.

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '( meta_key, meta_value ) VALUES ( 'THAT IS', 'DONE.')' at line 2] INSERT INTO ( meta_key, meta_value ) VALUES ( 'THAT IS', 'DONE.')

Thanks a bunch!!

Cheers Chris.



Read more here: https://stackoverflow.com/questions/64395740/cannot-access-newly-created-wordpress-table

Content Attribution

This content was originally published by Christian at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: