We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21242
    • 30 Posts
    EasyPoll issue on Evo install

    Hi,

    I am loving MODx, but not having much success with support on EasyPoll. Is there someone out there who would care to help? A solution on this project has now become critical...

    Below my initial query:

    Quote from: netbox at Aug 23, 2010, 10:03 AM


    I have Evo running on an IIS server. On my own (Apache) server EasyPoll seemed to work. However on the remote installation I get the following error when trying to create options for the Poll Question:

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - Field ’Votes’ doesn’t have a default value »
    SQL: INSERT INTO modx_ep_choice (idPoll,Title,Sorting) VALUES(’2’,’Biltong’,’1’)
    [Copy SQL to ClipBoard]

    huh
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Looks like your database is configured in "strict" mode, and the "votes" field was set to be NOT NULL but not given a default value. You’ll need to go into the database and edit the structure of the table to give the "votes" field a default value of 0.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 21242
        • 30 Posts
        Thanks Susan - will try that!
          • 21242
          • 30 Posts

          I do not have direct access to the DB - high security hosting for corporate client - but I requested an SQL dump. This is what I found in the file, from line 214:

          --
          -- Definition of table `modx_ep_choice`
          --
          
          DROP TABLE IF EXISTS `modx_ep_choice`;
          CREATE TABLE `modx_ep_choice` (
            `idChoice` int(10) unsigned NOT NULL AUTO_INCREMENT,
            `idPoll` int(10) unsigned NOT NULL,
            `Title` varchar(128) NOT NULL,
            `Sorting` tinyint(3) unsigned NOT NULL,
            `Votes` int(11) NOT NULL,
            PRIMARY KEY (`idChoice`)
          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
          


          Do you think it is a simple matter of requesting the DB admin to edit the table, so that it reflects the following on line 224 instead(??):

            `Votes` int(11) NOT NULL DEFAULT '0',
          

            • 21242
            • 30 Posts
            grin It worked!
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              If the database is configured in strict mode, any field with NOT NULL and no default value will cause that error if there’s no value being inserted for such a field. Hopefully more add-on authors will recognize this, and make sure their database tables are created with appropriate default values.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org