This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Reset ID number on the forms


  1. Panort
    Member

    I tried this

    << To reset entry ID number, you need open PHPMyAdmin. Go to your database and run this SQL
    ALTER TABLE ap_form_x AUTO_INCREMENT = 1;
    Change "x" with your form id, it should be like this "ap_form_2">>

    but it did not work. I had deleted all the entries and then ran the SQL as described above and the ID number did not reset. Any other suggestions?
    We use the forms to sign up for different golf days. When that day is over I reuse the form after deleting the names instead of making a new form every week. I would like the ID number to reset so we can see quickly how many have signed up each golf day.

    Posted 11 years ago #
  2. yuniar

    If you are using v3, you don't need to do the above.
    So, within v3, by default when you delete any entries they aren't actually being deleted from the table.

    To disable this functionality, thus deleting the entries permanently, you need to edit your config.php file, search for this line:

    define('MF_CONF_TRUE_DELETE',false);

    change it to become:

    define('MF_CONF_TRUE_DELETE',true);

    You can then reset the ID numbers simply by deleting ALL entries.
    If you already have empty entries, submit a new entry and then delete the entry by clicking "Select all entries in this form" and hit the delete button.

    That would delete all entries within that form and reset the ID number.


    MachForm Founder

    Posted 11 years ago #
  3. Panort
    Member

    Thank you very much. I am using V3.1 and so far I like it a lot. Thanks for your quick response. I did what you instructed and it is going back to 1.

    Posted 11 years ago #
  4. MvdL79
    Member

    And how do you do this with the ID numbers of forms?

    I deleted all forms, because I was still test driving my forms, but when I create a new form, it will continue with the numbering instead of starting with 1 again.

    Please explain how to reset this as well. I think, after explaining, it's should be stickied as well. ;)

    Posted 11 years ago #
  5. yuniar

    to reset the ID numbers of the forms, you will also need to do the above modification with config.php file.
    set this value:

    define('MF_CONF_TRUE_DELETE',true);

    then once you have all the forms deleted already, run this SQL query:

    ALTER TABLE ap_forms AUTO_INCREMENT = 1;

    MachForm Founder

    Posted 11 years ago #
  6. MvdL79
    Member

    Awesome thanks!

    //sidenote

    In (my) version of Machform 3.2 the variable 'MF_CONF_TRUE_DELETE' was already set to 'true' (by default installation).

    //update

    I deleted all forms, checked the config file (as mentioned above), but it was set correct and ran the SQL from PhpMyAdmin. It said it worked. Went back to Machform and created a new form, but it starts with ID 2, instead of ID 1...? Any ideas?

    Posted 11 years ago #
  7. yuniar

    Try to delete all forms again and then run these queries:

    DELETE FROM ap_forms;
    DELETE FROM ap_form_elements;
    DELETE FROM ap_element_options;
    DELETE FROM ap_element_prices;
    ALTER TABLE ap_forms AUTO_INCREMENT = 1;

    MachForm Founder

    Posted 11 years ago #
  8. MvdL79
    Member

    Thanks man! That worked.

    * bookmarked for future reference *

    Posted 11 years ago #
  9. darnellsmith
    Member

    Does this deleting and resetting of form IDs work for an individual form or across all forms in the database? What if I just want to reset one form back to 1 after deleting all the content?

    Posted 9 years ago #
  10. yuniar

    This will work on individual form only. It won't reset all your forms, unless you choose to delete them one by one.


    MachForm Founder

    Posted 9 years ago #

RSS feed for this topic

Reply