I'm getting an error like this while trying to login. It works fine on my hosting yet I want to work on office with localhost, so when it comes to localhost i'm getting ERROR NUMBER : 1064. Can anyone help me please ?
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups ON groups.id = user_group.group_id WHERE user_group.user_id ='1'' at line
My code :
{
$sql = "
SELECT *
FROM user_group
JOIN groups
ON groups.id = user_group.group_id
WHERE user_group.user_id =?";
$query = $this->db->query($sql, array($user_id));
$result = $query->row_array();
return $result;
}