WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form DB
[resolved] [Plugin: Contact Form 7 to Database Extension] Errors - Division by zero (18 posts)

  1. stimsonm
    Member
    Posted 3 years ago #

    Hello, I installed the latest version of the fast and secure contact form and the contact form 7 to database extension and when i go to the admin to see a form submitted i see these errors only:

    Division by zero in /var/www/vhosts/mydomainname.org/httpdocs/wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php on line 980

    and

    Fatal error: Call to undefined function mysql_set_charset() in /var/www/vhosts/mydomainname.org/httpdocs/wp-content/plugins/contact-form-7-to-database-extension/CFDBQueryResultIterator.php on line 105

    Can anyone help me out?

    Thanks

  2. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    This is because you are running a version of PHP5 that less than 5.2.3. Can you configure to run version 5.2.3 or later?

  3. stimsonm
    Member
    Posted 3 years ago #

    Thanks Michael, I'll block a day off and upgrade that, things never go smoothly :-) Great plugin, can't wait to use it.

    Take care

  4. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    In the mean time, it may work OK if you change that line of code:

    mysql_set_charset('utf8', $con);

    to:

    if (function_exists('mysql_set_charset')) { // PHP 5 >= 5.2.3
                mysql_set_charset('utf8', $con);
            }
  5. stimsonm
    Member
    Posted 3 years ago #

    great thanks Michael, that killed one of the errors and I see the table now but I still have this error: Warning: Division by zero in /var/www/vhosts/mydomainname.org/httpdocs/wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php on line 980

    Any ideas on that one?

  6. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    Go to the Database Options page. Is there anything in "Maximum number of rows to retrieve from the DB for the Admin display" ?

    If not, put something there like 100. That should have been put there during the upgrade...

  7. stimsonm
    Member
    Posted 3 years ago #

    That worked, thank a ton, this is a great plugin, exactly what I needed.

    Take care

  8. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    Test submitting a form and see if it captures the data. I'm concerned that your update to 1.8 stuff did not run which includes a change to the DB table that may cause inserts to fail.

  9. stimsonm
    Member
    Posted 3 years ago #

    worked perfectly, thanks, one more question, I'm trying to display the table on a page using the shortcode: [cfdb-table form="1"] and i even tried this: [cfdb-datatable form="1"] but the page is blank?

    Any ideas?

    Thanks again

  10. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    To verify:
    Your form name is "1" and there is data in it when you view in the admin Database page and select "1" from the drop-down?

  11. stimsonm
    Member
    Posted 3 years ago #

    yes, Form: 1 and there is data in there

  12. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    It is called "1" or "Form: 1", i.e. [cfdb-table form="Form: 1"]

  13. stimsonm
    Member
    Posted 3 years ago #

    that was it, nice. is there anyway to add a download to csv on the web page with that table?

  14. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

  15. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    If you set "Can See Submission data" to "Anyone" it should work

  16. stimsonm
    Member
    Posted 3 years ago #

    beautiful, works perfectly. Thanks for all your help today.

  17. belinep
    Member
    Posted 3 years ago #

    To the plug-in authors:

    A quick fix for "Returned entries 1 to 0" and "Warning: Division by zero" issues.

    Add:

    $maxRows = ($maxRows > 0 ? $maxRows : 20);

    After line 733 in "/wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php"

    Or, if you don't mind excessive database calls, just change line 733 to:

    $maxRows = ($this->getOption('MaxRows') > 0 ? $this->getOption('MaxRows') : 20);

    Badabing.

  18. Michael Simpson
    Member
    Plugin Author

    Posted 3 years ago #

    I version 1.8.2 should be available shortly and it has a fix like you suggest.
    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic