I am not confirmed with this query… I feel like somewhere the CU or CI has been misplaced…
This query worked properly without using $db->nameQuote in sql.
$query = 'SELECT '. $db->nameQuote(CU.'id')
.' FROM '. $db->nameQuote('#__users'), $db->nameQuote('#__community_cinvit' CI)
.' WHERE '. $db->nameQuote(CU.'email').'='.$db->Quote(CI.'to_email')
.'AND'. $db->nameQuote(CI.'point_given').'='.$db->Quote('1');
$db->setQuery($query);
$conn = $db->loadResult();
echo $conn;
is there any error in CU and CI
add white space before
.' AND'.and addCUto$db->nameQuote('#__users' CU)