Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Can't get nested categories to work (SQL Error)

edited February 2011 in Vanilla 2.0 - 2.8
First I could not get it to work on my test upgrade, so I tried a new install.
Tried 2.0.17.8 connected to a blank database schema. Created a new category c1. Created a new category c1.1.
Tried to place c1.1 under c1.
It tries to run
update GDN_Category Category set
TreeLeft = :TreeLeft,
TreeRight = :TreeRight,
Depth = :Depth,
Sort = :Sort,
ParentCategoryID = :ParentCategoryID,
PermissionCategoryID = :PermissionCategoryID
where CategoryID = :CategoryID

with the data
_NamedParameters Array [7]
:TreeLeft 1
:TreeRight 8
:Depth 0
:Sort 1
:ParentCategoryID none
:PermissionCategoryID -1
:CategoryID -1

and returns a
Incorrect integer value: 'none' for column 'ParentCategoryID' at row 1|Gdn_Database|Query|update GDN_Category Category set
TreeLeft = :TreeLeft,
TreeRight = :TreeRight,
Depth = :Depth,
Sort = :Sort,
ParentCategoryID = :ParentCategoryID,
PermissionCategoryID = :PermissionCategoryID
where CategoryID = :CategoryID

Bug or am I doing something wrong?

Comments

  • This data in your update information:
    :ParentCategoryID none
    Returns an incorrect integer value:
    Incorrect integer value: 'none' for column 'ParentCategoryID' at row 1
    That means that :ParentCategoryID cannot be a string, but it has to be an integer number. If parent category is none, then make it 0 and see what happens.

    There was an error rendering this rich post.

  • It is a bug. Jquery returns "none" when the db wants a null.
    Added a pull request with the addition to the category model at line 456
    else if ($ParentCategoryID == 'none')
    $ParentCategoryID = null;
Sign In or Register to comment.