Mysql – SQl connection to XAMP

connectivityMySQL

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

Best Answer

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

Related Question