i am trying to connect my database to XAMP . I got this error

Warning: Use of undefined constant ID - assumed 'ID' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\Thairis\login.php on line 8

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\Thairis\connectdb.php:27 Stack trace: #0 C:\xampp\htdocs\Thairis\login.php(11): include() #1 {main} thrown in C:\xampp\htdocs\Thairis\connectdb.php on line 27

1 Answer 1


mysql_* functions

  • officially deprecated as of PHP 5.5 (released June 2013).
  • removed entirely as of PHP 7.0 (released December 2015)

So switch to mysqli or pdo and use always prepared statements with parameters because of sql injections

see api comparison

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.