$sql = "INSERT INTO league(user,email,password,rival,key) VALUES ('$this->user','$this->email','$this->pass','0','0')"; 

mistake:

You have an error in your SQL syntax; check the syntax for the use of the syntax to use the 'key') VALUES ('user1', 'user1@gmail.com', 'usrpsw', '0', '0') 'at line 1

field key int (11) NULL (no) DEFAULT 0

  • key int (11), and write the string - Valeriy Karchov
  • removed quotes: You have an error in your SQL syntax; check the syntax for the use of the syntax to use the 'key) VALUES (' user1 ',' user1@gmail.com ',' usrpsw ',' 0 ', 0)' at line 1 - Smash
  • meaning key must be a number - Valeriy Karchov
  • so I inserted 0 without quotes, i.e. number if 1 put the same syntax error. - Smash
  • and if just '' (nothing), the syntax error is also ... nonsense, but it is. - Smash

1 answer 1

 $sql = "INSERT INTO league(user,email,password,rival,`key`) VALUES ('$this->user','$this->email','$this->pass','0','0')"; 

key and other reserved fields need to be taken in `