Author Topic: Database reset - category numbers.  (Read 5194 times)

0 Members and 1 Guest are viewing this topic.

Offline airphoto

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://www.airphoto.co.uk
Database reset - category numbers.
« on: March 06, 2003, 03:03:27 PM »
Is it possible to reset the category numbers without disturbing the database?

Having been in development for 6 months now I have deleted a lot of old categories that I no longer need. The numbering is now something like this.

1,4,9,10,12,18,23,24,30. etc.

I would like to be able to renumber them into their logical order again.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Database reset - category numbers.
« Reply #2 on: March 06, 2003, 06:34:29 PM »
The database tables leverage the auto_increment type available in MySQL for the category numbers.  The only way to "renumber" them is to try something like the following:

    Export all tables and data.

    Hand edit the table data in the exported file.  Affected tables are: 4images_categories, 4images_groupaccess, 4images_images, 4images_images_temp

    Import the tables and data[/list:u]
    phpMyAdmin is one of the best tools to use to import/export although it should be possible to use the database backup/restore in the admin control panel too.

    As you can see, all that hand editing can be prone to error so BE CAREFUL and always, always, ALWAYS keep a backup copy.

Offline airphoto

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://www.airphoto.co.uk
Database reset - category numbers.
« Reply #3 on: March 08, 2003, 11:44:52 AM »
Thank you.