On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi,

    I have this strange issue on a MODX 1.0.15 website: when trying creating a new chunk, it gets a value of 0 for the id.
    (The website is based on an existing website using YAMS, in which I imported records.)

    I checked the table structure and was surprised that the id colum was not a primary key.
    So, I set the column as Primary Key using phpMyAdmin.

    After that, I applied these two SQL requests:
    ALTER TABLE `modx_site_htmlsnippets` MODIFY COLUMN id INT auto_increment;
    ALTER TABLE `modx_site_htmlsnippets` AUTO_INCREMENT = 87;

    The AUTO_INCREMENT value was set to 87 because
    SELECT MAX(id) FROM `modx_site_htmlsnippets`
    returned 86.

    Despite this, new chunks still receive id 0 and the following MODx parsing error is returned:
    « MODX Parse Error »
    MODX encountered the following error while attempting to parse the requested resource:
    « Execution of a query to the database failed - Duplicate entry '0' for key 'PRIMARY' »
    SQL > INSERT INTO `somedatabase`.`modx_site_htmlsnippets` (`name`, `description`, `snippet`, `locked`, `category`) VALUES('hello', '', 'world', '0', '0')

    Thank your for your help.