I'm quite new to SQL and PHP and tried two write an array into the database, but I couldn't figure it out so far I always get following Error:
1054 Unknown column 'Array' in 'field list' SQL=UPDATE #__typsys SET usergroup = Array WHERE userid = 687
I tried it this way:
// Get an Array with all the Usergroups the user is in
$usergroups = JFactory::getUser()->getAuthorisedGroups();
// Building the updatequery
$query = $db->getQuery(true);
$query
->update($db->quoteName('#__typsys'))
->set($db->quoteName(usergroup) . ' = ' . $db->quote($usergroups))
->where($db->quoteName('userid') . ' = ' . $user->id)
;
// Executing the updatequery
$db->setQuery($query);
$db->execute();
If I write a normal string like "test" in the database everything works fine, but not with an array. I have searched for hours now, but didn't find any solution. Help is much appreciated!!!
Thx in advanced!