Connect to database using MySQLi


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. define('HOST', 'localhost');
  2. define('USER', 'root');
  3. define('PASS', 'root');
  4. define('DATABASE', 'analytics');
  5. define('ENCODING', 'utf8');
  6.  
  7. $database = new mysqli(HOST, USER, PASS, DATABASE);
  8. $database->query('SET NAMES '.ENCODING);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.