• Resolved isaac_ho

    (@isaac_ho)


    When create a subscriber manually, it prompts error:
    WordPress database error Field 'ip' doesn't have a default value for query INSERT INTO wp_knewsusers (email, lang, state, joined, confkey) VALUES ('isaacho0128@gmail.com','en', 2, '2013-09-09 13:50:33','2ec4cd90'); made by do_action('k-news_page_knews_users'), call_user_func_array, KnewsPlugin->KnewsAdminUsers, require('E:\website\localuser\test.office.anywhere\wwwroot\wp360\wp-content\plugins\knews\admin\knews_admin_users.php')

    http://wordpress.org/plugins/knews/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Any response to this please – becoming most urgent.
    Thanks

    Here’s a fix

    Change the structure of the table wp_knewsusers to specify a default value for all the varchar columns that are set to not null – especial the field IP.

    Watch out for next upgrade of plugin – might get overriden?????

    Plugin Author creverter

    (@creverter)

    The ID field should be auto-increment, maybe you are lost this param in a database import-export?

    From the includes/knews_installDB.php:

    $sql = “CREATE TABLE ” .KNEWS_USERS . ” (
    id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
    email varchar(100) NOT NULL,
    state varchar(2) NOT NULL,
    joined datetime NOT NULL,
    confkey varchar(32),
    lang varchar(12) NOT NULL,
    ip varchar(45) NOT NULL,
    UNIQUE KEY id (id)
    )$charset_collate;”;

    dbDelta($sql);

    Please, check everything in the tables estructure, and give us feedback!
    Carles.

    The problem is not the auto increment, the problem is where you specify a column as not null and you do no provide a default value. The insert statement does not provide a value for the column ip, MySQL then has to fill the column with a default value, which in this instance does not exist, which in turn causes the INSERT to fail.

    A more correct syntax for the columns which are not null would be
    [column name] NOT NULL DEFAULT ” – now when you do not specify a value for this column in the INSERT statement MySQL will know what to do.

    BTW It is also good SQL practise to create a PRIMARY KEY for every table, instead of using only a UNIQUE KEY, a table can have multiple UNIQUE KEYs but only one PRIMARY KEY.

    Hope that helps
    Regards
    Dirk

    Plugin Author creverter

    (@creverter)

    Oh! I’m sorry!!! I read ID, not IP!!! You’re right, it’s a bug…

    Next release will solve the issue: Knews 1.4.9

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘BUG – Create a subscriber manually’ is closed to new replies.