querying the db from a plugin problem (3 posts)

  1. alalex
    Posted 6 years ago #

    I'm developing a plugin and I am completely unable to insert things to the db. I've tried I think everything and nothing!

    There is a main file with the activation function that creates a table in the db (And it works fine)

    Then in the plugin page there is a form that I use to add rows to the db. But it doesn't seem to work...
    Here is the Insert code:

    $insert = "INSERT INTO " . $table_name .
    " (name, selector, bg, color, font, apply) " .
    "VALUES ('$name','$selector'.'$bg','$color','$font','$apply')";
    $results = $wpdb->query($insert);

    The $table_name is perfectly fine. There is also the field id at the beginning, but it's set to auto_increment so there is no need to put it there.


  2. MichaelH
    Posted 6 years ago #

    So the table name has the $table_prefix as part of the string?

  3. MichaelH
    Posted 6 years ago #

    Also shouldn't that be a comma between $selector and $bg

    "VALUES ('$name','$selector'.'$bg','$color','$font','$apply')";

Topic Closed

This topic has been closed to new replies.

About this Topic