0

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;

    }

Strawberry
  • 33,750
  • 13
  • 40
  • 57
  • 2
    Groups is a reserved word in MySQL 8+ – Strawberry Mar 20 '21 at 10:16
  • 1
    Does this answer your question? [Syntax error due to using a reserved word as a table or column name in MySQL](https://stackoverflow.com/questions/23446377/syntax-error-due-to-using-a-reserved-word-as-a-table-or-column-name-in-mysql) – imposterSyndrome Mar 20 '21 at 10:29

0 Answers0