Post by gg263 » Wed Oct 10, 2007 1:02 am

Error: Out of range value adjusted for column 'parent_id' at row 1
Error No: 1264
insert into category set image_id = '41', sort_order = '1', parent_id = '', date_added = now()

what's wrong with this?

and my website is http://1121.uni.cc

Newbie

Posts

Joined
Wed Oct 10, 2007 12:58 am

Post by robnardo » Thu Oct 11, 2007 9:41 pm

I am getting the same error when adding a category.  I believe the problem has to do with not being able to find an underscore in the request path.  I think the programmer (Daniel) plans to add a way to define a parent category - so that sub categories can be created.  To TEMPOARILY solve the problem, go to /admin/controller/category.php (version 0.7.7) and change lines 38 and 39 from:

Code: Select all

$sql = "insert into category set image_id = '?', sort_order = '?', parent_id = '?', date_added = now()";
$database->query($database->parse($sql, $request->get('image_id', 'post'), $request->get('sort_order', 'post'), end(explode('_', $request->get('path')))));
to

Code: Select all

$sql = "insert into category set image_id = '?', sort_order = '?', parent_id = 0, date_added = now()";
$database->query($database->parse($sql, $request->get('image_id', 'post'), $request->get('sort_order', 'post')));
;D
Last edited by robnardo on Fri Oct 12, 2007 3:37 am, edited 1 time in total.

Newbie

Posts

Joined
Sat Sep 08, 2007 1:01 am

Post by robnardo » Fri Oct 12, 2007 3:16 am

I am providing an update because the above code I provided will not allow the addition of sub-categories.  Here is the revised replacement code that will allow sub-cateogries:

Code: Select all

if ( end(explode('_', $request->get('path'))) != '') {
	$sql = "insert into category set image_id = '?', sort_order = '?', parent_id = '?', date_added = now()";
	$database->query($database->parse($sql, $request->get('image_id', 'post'), $request->get('sort_order', 'post'), end(explode('_', $request->get('path')))));
} else {
	$sql = "insert into category set image_id = '?', sort_order = '?', parent_id = 0, date_added = now()";
	$database->query($database->parse($sql, $request->get('image_id', 'post'), $request->get('sort_order', 'post')));
}
There is probably and easier way to do the above.  FYI - I am using PHP 5.1.2 and MySQL 5.  I think that this error occurs only if using MySQL 5.
Last edited by robnardo on Fri Oct 12, 2007 3:38 am, edited 1 time in total.

Newbie

Posts

Joined
Sat Sep 08, 2007 1:01 am
Who is online

Users browsing this forum: No registered users and 4 guests