WordPress.org

Ready to get started?Download WordPress

Forums

MailPoet Newsletters
Database Import Errors (16 posts)

  1. WPwebbouw
    Member
    Posted 1 year ago #

    When I import a WP database that has WYsija installed, PhpMyAdmin throws an error at the wp_wysija_user_field table. The query that causes this problem is something like:

    INSERT INTO wp_wysija_user_field ( field_id, name, column_name, type, values, default, is_required, error_message ) VALUES ( 1, 'First name', 'firstname', 0, NULL, '', 0, 'Please enter first name' );

    I figured this could be caused by the use of reserved MySQL keywords values and default without escaping them with backslashes. When I backslash these words the import completes with no error.

    INSERT INTO wp_wysija_user_field ( field_id, name, column_name, type, values, default, is_required, error_message ) VALUES ( 1, 'First name', 'firstname', 0, NULL, '', 0, 'Please enter first name' );

    This has happened to me several times in various versions of Wysija. Is this a known bug?

    http://wordpress.org/extend/plugins/wysija-newsletters/

  2. George Mamadashvili
    Member
    Posted 1 year ago #

    Hello WPwebbouw,

    What version are you using? Can you reproduce this issue with latest version?

    George

  3. WPwebbouw
    Member
    Posted 1 year ago #

    Hi George,

    Yes I can reproduce it with WySija 2.5.4.

    However I found that it depends on the way the database has been exported. I use a backup plugion that exports the database in the above mentioned way. But this morning I made an export using PhpMyAdmin and this produced a different sql:

    INSERT INTO wp_wysija_user_field VALUES ( 1, 'First name', 'firstname', 0, NULL, '', 0, 'Please enter first name' );

    You see the column names are omitted here from the INSERT statement, only the table name is given. Another difference: the table name is backslashed.

    Since both forms of the INSERT statement (with and without column names) are allowed, the problem still occurs on database exports that use the INSERT statement with column names. This could be solved by avoiding the use of reserved MySQL keywords in the column names (values, default).

  4. teodorsavic
    Member
    Posted 11 months ago #

    I am having the exact same problem. It depends on the way I export the database. If I just export dump.sql file I get this error while trying to import database:
    Error
    SQL query:

    INSERT INTO wp_wysija_user_field ( field_id, name, column_name,
    TYPE ,
    VALUES , DEFAULT, is_required, error_message )
    VALUES ( 1, 'First name', 'firstname', 0, NULL , '', 0, 'Please enter first name' ) ;

    MySQL said: Documentation

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'values, default, is_required, error_message ) VALUES ( 1, 'First name', 'firstna' at line 1

    But if I manually export the database in gzip format I can import it without any trouble.. What could cause this?

  5. WPwebbouw
    Member
    Posted 11 months ago #

    @teodorsavic as I mentioned in my previous post this is probably due to the different ways database dump scripts handle INSERT statement. Your manually gzip export probably uses the INSERT statement without column names. You could check that if you unzip the file and examine it in Wordpad.

    Pity the Wysija folks haven't responded to this thread yet. Must be busy :)

  6. teodorsavic
    Member
    Posted 11 months ago #

    Thank you very much for your answer. The problem in my case is that I use a plugin that automatically backs up my website and I don't have a choice of the database export method. I always get the dump.sql file that I can't use. Is there any chance I could e.g. import the database to my local wamp server's phpmyadmin and then export it in gzip format so that I can use it? Is there some way around this?

    Sorry for bothering you.
    Best regards!

  7. WPwebbouw
    Member
    Posted 11 months ago #

    You can manually edit the sql file if you unzip it. I always edit sql files in Wordpad. If you search for the string INSERT INTO wp_wysija_user_field and `backtick` the words values and default, then save the file, zip it again (if necessary) then it will import oke.

  8. teodorsavic
    Member
    Posted 11 months ago #

    Thank you very much. I found that line but I don't quite understand what do you mean by 'backtick'.. This is what I have in the database:

    INSERT INTO wp_wysija_user_field ( field_id, name, column_name, type, values, default, is_required, error_message ) VALUES ( 1, 'First name', 'firstname', 0, NULL, '', 0, 'Please enter first name' );
    INSERT INTO wp_wysija_user_field ( field_id, name, column_name, type, values, default, is_required, error_message ) VALUES ( 2, 'Last name', 'lastname', 0, NULL, '', 0, 'Please enter last name' );

    What should I do with it?

  9. teodorsavic
    Member
    Posted 11 months ago #

    I edited it to:
    INSERT INTO wp_wysija_user_field ( field_id, name, column_name, type, 'values', 'default', is_required, error_message ) VALUES ( 1, 'First name', 'firstname', 0, NULL, '', 0, 'Please enter first name' );
    INSERT INTO wp_wysija_user_field ( field_id, name, column_name, type, 'values', 'default', is_required, error_message ) VALUES ( 2, 'Last name', 'lastname', 0, NULL, '', 0, 'Please enter last name' );

    but I got the error again:

    SQL query:

    INSERT INTO wp_wysija_user_field ( field_id, name, column_name,
    TYPE , 'values', 'default', is_required, error_message )
    VALUES ( 1, 'First name', 'firstname', 0, NULL , '', 0, 'Please enter first name' ) ;

    MySQL said: Documentation

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''values', 'default', is_required, error_message ) VALUES ( 1, 'First name', 'fir' at line 1

  10. WPwebbouw
    Member
    Posted 11 months ago #

    Hi teodorsavic, backtick is on my keyboard the ` which is located top left above the Tab key. They are different from normal single quotes, which don't work in column names and cause the error msg. Surround the two words with those backtick quotes instead.

  11. teodorsavic
    Member
    Posted 11 months ago #

    That's it!
    There are no words in this world that can express how thankful I am for this. You helped me more than you can imagine. Thank you very much for spending your time helping me.
    I think this is a quite useful topic that will help many people. With my novice questions and your precise answers, I think everybody would be able to fix this without any problem :)

    Thank you once more!
    Best regards!

  12. MailPoet Staff
    Member
    Plugin Author

    Posted 11 months ago #

    The community helps one another. That's just awesome!

  13. WPwebbouw
    Member
    Posted 11 months ago #

    Yeah sure @wysija, we're awesome. As are you :) However I would still like to see you comment on the issue itself. Has this bug been scheduled for fixing in a next version?

  14. MailPoet Staff
    Member
    Plugin Author

    Posted 11 months ago #

    We'll get back to you on this.

  15. dscherry
    Member
    Posted 10 months ago #

    Unable to Import either CSV or copy and paste same. Receive this error message:

    Table 'yourlifebettern.bh75vks7x_wysija_user_list' doesn't exist (UPDATE bh75vks7x_wysija_user_list AS A JOIN bh75vks7x_wysija_user AS B ON A.user_id = B.user_id SET A.unsub_date = 0, A.sub_date = 1382108123 WHERE STATUS = 1 AND sub_date =0)

    Please advise. Thanks. Darrell

  16. Tung Wysija
    Member
    Posted 10 months ago #

    Hello Dscherry,
    It's very strange when the table "user_list" does not exist.
    Do you have any access to database?
    Can you look at it and let us know.

    Tung - from MailPoet team.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic