SQL = INSERT INTO`#__ user_usergroup_map`(`user_id`,`group_id`)VALUES(,2) - 数据库未更新

I have responsibility of a Joomla! 3.5.1 website. New users are added by a script in which an 'operator' may add a member. However, recently I have encountered a problem where the message, " SQL=INSERT INTO #__user_usergroup_map (user_id,group_id) VALUES (, 2) -- database was not updated" is returned.

I have looked in the JFacotry API & found the module 'com_users" holds the script which makes the BIND with all data for the Params & then passes it to SQL for execution of an INSERT INTO statement for the #__user_usergroup_map table.

However, I don't see the SQL statement in the execution of the code. but $user->getError certainly returns a SQL error.

My understanding of the problem, the code is not providing a user id as one of the 2 required variables for the INSERT INTO statement. When the process works, the code generates a new user id & provides it into the SQL statement.

This has worked in the past since we were using Joomla! 1.5. Now we are moving to Joomla! 3.5.1 but want to maintain the same member addition methodology.

Is there some special constraints upon the #__user_usergroup_map table that are not in place?

Can anyone help?

You must use the mark ' and user_id value is auto increment values empty.

$sql = mysql_query("INSERT INTO `__user_usergroup_map` (`user_id`,`group_id`) VALUES ('', '2')");