Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

Who's Online 10

BulliesofNCCurtisOdenericgillettefh111tc74 +5 guests

Problem Adding Categories

I've just installed Vanilla forums and I was trying to add some categories but I keep getting an error. I enabled detailed errors and it tells me:

Duplicate entry '2147483647' for key 'PRIMARY'

Does anyone have any idea how to solve this problem?

please help!!!

Thanks in advance Thomas

Comments

  • Posts: 14

    After a bit more investigation, what I think is going wrong is that every tim it tries to add a category it uses the same key as the existing one if that helps? Anyone any ideas?

  • TimTim
    Posts: 1,573 1 like

    2147483647 is actually MAX SIGNED INT. Looks like something is up with your database. PHP version, MySQL version, Vanilla version?

    Vanilla Forums Senior Developer [GitHub, Twitter, About.me]

  • Posts: 14

    Hi,

    PHP is version 5.2.17

    MySQL is version 5.0.32

    Vanilla is the latest version

  • Posts: 14

    I did a complete clean install and it's doing the exact same thing. Every other aspect seems to work fine.

  • 422422
    Posts: 2,109 1 like

    Perhaps post copy of your php.ini for the devs to check , i only ever had problems With pdo and bwlimited .. I really dont get under the hood.

    ♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads

  • Posts: 14

    I'm not sure my hosting provider will let me access the php.ini file. I will check.

  • 422422
    Posts: 2,109

    Create a file called phpinfo.php and put this in it.

    <?php phpinfo(); ?>

    Upload that file anywhere on your website and call it up in your browser.

    ♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads

  • Posts: 14
  • 422422
    Posts: 2,109

    Looks ok, im no expert. Far from it, suhosin has give us grief before. Hopefully one of the guys here can help

    ♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads

  • Posts: 14

    Thanks for your help anyway - I was able to manually create categories by editing the database in the sql editor - but I still can't create them directly.

  • 422422
    Posts: 2,109

    You did install correctly? And 777 appropriate folders. Have u deleted all .ini files in cache folder.

    Sometimes u have go to via cpanel filemanager to set permissions... Clutching at straws for you.

    ♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads

  • Posts: 14

    yep, did all that!

  • x00x00
    Posts: 1,548

    hm categories you say. Sound like an increment problem

    I believe root is -1, is the column signed or unsigned? Perhaps the default is to make it unsigned, and that is causing the problem.

    grep is your friend.

  • Posts: 14

    I'm not brilliant with SQL - how do I tell?

  • x00x00
    Posts: 1,548

    In phpMyAdmin go to GDN_Category

    First root CategoryID should be -1 the first row.

    then look at the structure of the table. There is an auto increment on CategoryID

    at the bottom it says Next Autoindex, what does it say.

    grep is your friend.

  • Posts: 14

    Ok, Category ID is -1

    Next Autoindex says: 4,294,967,305

    Here's a screenshot of the structure:

    dl.dropbox.com/u/9380800/php-structure.png

  • 422422
    Posts: 2,109

    Wow

    ♥ I love Vanilla. VanillaSkins | on Twitter | on Facebook | Available Freelance | Take the Vanilla Test | Free Downloads

  • TimTim
    Posts: 1,573

    You can manually fix the auto index with:

    ALTER TABLE GDN_Category AUTO_INCREMENT = 5;
    

    Vanilla Forums Senior Developer [GitHub, Twitter, About.me]

  • Posts: 14

    Ok, I did that and now it says next auto index = 18,446,744,073,709,552,000

  • x00x00
    Posts: 1,548

    I've got

     Keyname                    Type    Unique  Packed  Column          Cardinality Collation
     PRIMARY                    BTREE   Yes     No      CategoryID      7           A
     K_Category_InsertUserID    BTREE   No      No      InsertUserID    2           A
    

    BTREE index.

    I would say it is a problem with the index being unsigned. try

    ALTER TABLE `GDN_Category` CHANGE `CategoryID` `CategoryID` INT( 11 ) SIGNED NOT NULL AUTO_INCREMENT 
    

    then

    ALTER TABLE GDN_Category AUTO_INCREMENT = 5;
    

    grep is your friend.

  • x00x00
    Posts: 1,548

    You could create your own mysl procedure to increment, but it does seem a little silly to come to that.

    grep is your friend.

  • Posts: 14

    I did that but the next index is still the same

    Is there a way to reset it completely?

  • x00x00
    Posts: 1,548

    grep is your friend.

  • Posts: 14

    Ok, I finally managed to fix it - I think

    I set the category ID of root to 1 which reset the auto index

    I then st it back to -1 and now it seems to be working again

    Thanks everyone for your help !

  • x00x00
    Posts: 1,548

    That is almost certainly a bug

    grep is your friend.

  • I am getting this same error. Tried doing same as fxgeek above and still not luck.

    "I set the category ID of root to 1 which reset the auto index

    I then st it back to -1 and now it seems to be working again"

    Not working for me.

  • Posts: 14

    You might need to also run the commands that x00 suggested above to reset the sequence.

    From what I can make out from the documentation of the SQL bug it won't allow the auto increment values to be read if the root is set to -1 so try setting it to 1, run the commands above, and then set it back to -1

    I'm not 100% sure of how I fixed it in the end because I was fiddling around with it for days, but it's something they're going to have to address if more people are having it

  • Thanks, I will try it. I was a bit confused about the order of things. Will report on it in a few.

  • That worked!!! You just have to followed the steps in order of what you said. Thanks so much!

Sign In or Register to comment.