I am trying to get a user id based on a username I have in a variable. When the call is returned it is only giving the first character of the id instead of the full id number.
Code: Select all
$row['r_1'] = "joe";
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id','username');
$query->from($db->quoteName('#__users'));
$query->where($db->quoteName('username')." = ".$db->quote($row['r_1']));
$db->setQuery($query);
$result = $db->loadResult();
echo "username $row['r_1'] has id: ".$result['id'];