Categories Disappearing
Author: an0n
Added: July 13, 2007
Ok, so you decided to use a dump .sql file to import your categories. Great!
You managed to save hours, even days if not weeks of hardwork and dedication to your directory.
(btw, i do not condone the use of categorical dumps of any kind whatsoever this)
If you did not use a dump file head on over here
The Problem:
Every time you add a new category another category is disappearing.
The problem lies within the mySQL Database and the PLD_CATEGORY_SEQ table.
What this able represents is the category ID of the next level to use based off of your PLD_CATEGORY table.
The example and explanation:
- If you have 10 categories in your PLD_CATEGORY table you will have a unique ID for each one of the, ranging from 1 through 10.
- Now, every time you add a new category, the PLD_CATEGORY_SEQ table is polled to gather the next ID that is sequential to the PLD_CATEGORY table.
- So, having 10 categories, and when adding a new one, it will grab the updated PLD_CATEGORY_SEQ ID and use that value to represent the new category you just added.
- And since we have 10 categories in our example, the next sequential ID from 10 would be? you guessed it; 11.
But what if the PLD_CATEGORY_SEQ file was NOT updated correctly when you imported the dump? Uh oh, BIG BIG problems!
It's ok though, I have an easy solution for you.
The solution:
- Login into your phpMyAdmin and access your database.
- Reimport you faulty category dump again, to get the correct structure that you originally had.
- After you've done that, now copy and past this code below, and everything will be right as rain:
UPDATE PLD_CATEGORY_SEQ SET ID = (SELECT `ID` FROM `PLD_CATEGORY` ORDER BY `ID` DESC LIMIT 1)+1
What does this do?
- that will sync the PLD_CATEGORY_SEQ Table with the PLD_CATEGORY. You dont even have to touch the PLD_CATEGORY_SEQ table to edit any value. You don't even have lurk through your PLD_CATEGORY table to find the highest ID to then modify the PLD_CATEGORY_SEQ table.
- What this does is, automatically grab the highest value of ID in your PLD_CATEGORY table and then adds 1 to it (to increment and ready itself up for the next new category to be added) and then updates the PLD_CATEGORY_SEQ table all in one easy shot.
If any of this seems a bit too technical, you can always get a hold of me on the phpLD forums. I'm a Moderator and frequent between forums often. Here is a direct link to my profile(yes I'm the green guy)
I hope this helps at least one person out, because this has been a forever and never ending battle for almost a year now.
Regards to all,
Rob
DirectoryDump Web Directory