phpLD Category Import

Discussion in 'Directories' started by t-bo, Sep 2, 2006.

  1. #1
    Hi

    Anyone know where I can get the sql to import categories for phpLD 3.0.6. I downloaded one yesterday, it installed and looked ok, but when trying to add a further subcategory I got SQL errors. I presume it wasnt compatible with phpLD 3.0.6?

    Thanks for any help...
     
    t-bo, Sep 2, 2006 IP
  2. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #2
    sigh... if people are going to provide imports update the god damn pld_category_seq table.
    [/end rant]

    t-bo, copy this code into your phpMyAdmin and run it.


    code:

    update PLD_CATEGORY_SEQ
    set id = (select count(id)+1 from PLD_CATEGORY)



    edit:

    a little explanation i figure wouldn't hurt.

    that code above grabs the total count of rows in the pld_category table, and then increments it by 1 and adds it to the pld_category_seq table.

    the pld_category_seq table is used to add categories. when adding a new category/sub category, it grabs the lastest id in the pld_category_seq table and assigns the newly created category with that ID, which is to be used in the pld_category table. It is auto incremented, so after it's grabbed, +1 is added to it so the next new category will have a new unique ID

    Hope this explanation is somewhat understandable for most people.

    Rob
     
    an0n, Sep 2, 2006 IP
  3. t-bo

    t-bo Active Member

    Messages:
    170
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Thanks for your help Rob, much appreciated.
     
    t-bo, Sep 3, 2006 IP
  4. SiteExpress

    SiteExpress Well-Known Member

    Messages:
    1,355
    Likes Received:
    153
    Best Answers:
    0
    Trophy Points:
    155
    #4
    Good post Rob.

    I would also like to add a bit more.

    There really is no such thing as "Not compatible" with 3.06, or about every version of phpLD.

    phpLD will update the database when it is installed. SO, if you have version 2 and want to upgrade to version 3.05, you dont have to change the database. Just run the install for 3.05 and it will update the database.


    If you have a database from version 3.0 and you want to import it into 3.06, just import the db, then run the install on the script.
     
    SiteExpress, Sep 3, 2006 IP
  5. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #5
    thx t-bo, thx jamey.

    It just dawned on me, that if these people aren't updating the pld_category_seq table, then it may in fact NOT even be there to begin with, so to update the code above, this will:

    first check to see if the table exists.
    if not, it will create it. if it does exist, nobiggie, it will just skip this process and update the necessary info accordingly.


    code:

    CREATE TABLE IF NOT EXISTS `PLD_CATEGORY_SEQ` (
    `id` int(11) NOT NULL auto_increment,
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    update PLD_CATEGORY_SEQ
    set id = (select count(id)+1 from PLD_CATEGORY);


    and that should take care of everything.

    if by chance you get an error due to the charset just remove ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
    from the create table portion and you should be good to go.

    Sorry for not even thinking of this before, but for those who know me (jamey ;)) they know I am a perfectionist and i most likely hit every angle possible to get it right the first time, so reiterating back is very rarely ever needed.

    thx again guys.

    Rob
     
    an0n, Sep 3, 2006 IP
  6. seoluv

    seoluv Active Member

    Messages:
    122
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Good post both, thanks
     
    seoluv, Sep 3, 2006 IP
  7. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #7
    I wanted to bump this thread for those who are new to phpld and are using the imported structure. This is also a request for those providing/offering the imported cats to get the files updated.

    I've run across several PMs the this past week and they were using an import that did not update the sequential table, thus screwing their directories around.


    suppliers:
    Those of you who are offering an imported categories list PLEASE update your import to include post #5 fix for your imports.

    users:
    run post #3 if you have not added any categories since your initial run of the import.

    if you have added categories after the fact, then check your category structure's integrity to ensure that everything is in fact in sync.



    Not all imports are bad, but a lot of them out there are.


    Thx,

    Rob
     
    an0n, Sep 28, 2006 IP
  8. SiteExpress

    SiteExpress Well-Known Member

    Messages:
    1,355
    Likes Received:
    153
    Best Answers:
    0
    Trophy Points:
    155
    #8
    Well said Rob. I get a lot of the same PMs. Best I can do is send them back to the one that makde the import.
     
    SiteExpress, Sep 28, 2006 IP
  9. an0n

    an0n Prominent Member

    Messages:
    5,688
    Likes Received:
    915
    Best Answers:
    0
    Trophy Points:
    360
    #9
    Hey Jamey :)

    You know I try my very best to help any and all people phpLD related, but my PM box is getting too cluttered again. I just cleared everything out the first week of august with over 525 and this month is proving no different. I've managed to get to about 99.9% of them, total divided by 2 = replies, but it's getting too reptitive now and I feel those offering the import need to fix their sh*t ;)

    [​IMG]

    :(
     
    an0n, Sep 28, 2006 IP