Community Support for OpenDocMan (Deprecated)
SQL error when adding user - Printable Version

+- Community Support for OpenDocMan (Deprecated) (https://forum.opendocman.com)
+-- Forum: OpenDocMan Community Discussion (https://forum.opendocman.com/forum-5.html)
+--- Forum: OpenDocMan Bug Reports (https://forum.opendocman.com/forum-8.html)
+--- Thread: SQL error when adding user (/thread-235.html)

Pages: 1 2


SQL error when adding user - ok2me - 05-10-2010

I've got a new installation and it's exhibiting this symptom:

http://www.opendocman.com/forum/viewtopic.php?f=4&t=192&p=292&hilit=error+add+user#p292

I tried the set sql_mode statement mentioned in another post and thought it was corrected but I was wrong, the issue is stil present today.
mysql> SET sql_mode = '';

I do notice that the user record does get created - I can retrieve it in subsequent queries, but it seems to be missing some of the data I filled in originally and that needs to be re-entered and resubmitted.

thanks,
Owen


Re: SQL error when adding user - Stephen - 05-10-2010

Are you getting the same "Integer for ID" error message?


Re: SQL error when adding user - ok2me - 05-11-2010

Here's the specific error message message I get when adding a new user:
Error in query: INSERT INTO odm_admin (id, admin) VALUES('7', ''). Incorrect integer value: '' for column 'admin' at row 1

The address bar shows "commitchange.php"

thanks much,
Owen


Re: SQL error when adding user - Stephen - 05-12-2010

Ok, around line 82 of commitchange.php change the line by adding a zero:

Change:
$_POST['admin']='';

To:

$_POST['admin']='0';

Let me know if this resolves your issue.


Re: SQL error when adding user - ok2me - 05-13-2010

Yes, that fixed the "add user" error. But then I immediately ran into another, similar, error. I added a user, then created a department, and attempted to change the new user to be in the newly created department and got this error:

Error in query: UPDATE odm_admin set admin='no' where id = '8'. Incorrect integer value: 'no' for column 'admin' at row 2

thanks,
Owen


Re: SQL error when adding user - ok2me - 05-13-2010

Update to previous post - the error occurs on the newly created user. I am able to change (without error) the department of users that existed prior to instituting the fix. Since I'm still in test mode, maybe I should flush the database and start from scratch? What would be the easiest way to do that?


Re: SQL error when adding user - Stephen - 05-13-2010

Change 'no' to '0' (zero).


Re: SQL error when adding user - Stephen - 05-13-2010

Also remove line 51:

$_REQUEST['admin']='no';

I am applying these fixes to my local version and will be adding them to the next release.


Re: SQL error when adding user - ok2me - 05-13-2010

What about lines the references to the value of admin in lines 133, 135, 144?
thanks,
Owen


Re: SQL error when adding user - Stephen - 05-13-2010

My line numbers are a little different because of some other changes I made, but in summary there are 3 changes:

1) Remove the following line near 49:
Code:
$_REQUEST['admin']='no';


2) Near line 79 change (add a zero in between the quotes):
Code:
if (!isset($_POST['admin']))
        {
                $_POST['admin']='';
        }

Change To:

Code:
if (!isset($_POST['admin']))
        {
                $_POST['admin']='0';
        }

3) Near line 135 change (replace 'no' with '0' )
Code:
if(!isset($_POST['admin']) || $_POST['admin'] == '')
    {
            $_POST['admin'] = 'no';
    }

Change To:

Code:
if(!isset($_POST['admin']) || $_POST['admin'] == '')
    {
            $_POST['admin'] = '0';
    }

Are there other spots that you were thinking needed to be changed?