User Account Creation Error
5 posts by 2 authors in: Forums > CMS Builder
Last Post: June 5, 2009 (RSS)
By Kenny - June 4, 2009
MySQL Error: Column 'isAdmin' cannot be null
I kinda know what that means, but why is it happening?
Thanks,
Kenny
Re: [sagentic] User Account Creation Error
By Dave - June 4, 2009
Is that with the latest version? (1.28)?
interactivetools.com
Re: [Dave] User Account Creation Error
By Kenny - June 4, 2009
Re: [sagentic] User Account Creation Error
By Dave - June 4, 2009
- Open /lib/menus/default/save.php
- Search for: isIntColumn
- Replace this code block:
// save blank int column values as null
$columnType = @$mySqlColsAndTypes[$colName];
$isIntColumn = preg_match("/^(tinyint|smallint|mediumint|int|bigint)/i", $columnType);
if ($value == '' && $isIntColumn && $fieldType != 'checkbox') {
$colsToValuesString .= "`$colName` = NULL, ";
}
With this one (new code in red):
// save blank int column values as null
$columnType = @$mySqlColsAndTypes[$colName];
$fieldType = @$schema[$colName]['type'];
$isIntColumn = preg_match("/^(tinyint|smallint|mediumint|int|bigint)/i", $columnType);
if ($value == '' && $isIntColumn && $fieldType != 'checkbox') {
$colsToValuesString .= "`$colName` = NULL, ";
}
>why is it happening?
It's a bug (thanks for reporting it!), and since you asked... :) Here's the technical details:
We added support for custom mysql column types (INT, etc) in the field editor a while back. The problem with that is those field only support a number or null, there is no "blank". So people saving a record with no value for a integer field would modify it and see a zero the next time. So we added some code to save integers as null if they have no value. Except checkboxes are store as tinyint's (as 0 or 1) but don't support NULLs, so the above code adds an exception for checkboxes.
Hope that helps, let me know if that patch fixes the problem or if there are any other issues.
interactivetools.com
Re: [Dave] User Account Creation Error
By Kenny - June 5, 2009
Thanks!