0

while trying to link my database to my server using xampp for the first time to test it out with the following code :

    <?php

$host = 'localhost';
$user = 'root';
$pass = '';
$db_name = 'blog';

$conn = new MySQLi($host, $user, $pass, $db_name);

if ($conn->connect_error) {
    die('Database connection error: '. $conn->connect_error);
}
?>

the result on my browser/server is blank how do i go about this and also creating a root user user on mySQL

  • When running something for testing, worth enabling errors so that you can quickly see if there is anything wrong (https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display) – Nigel Ren May 31 '20 at 07:35
  • Check this it will help you: https://www.cloudways.com/blog/connect-mysql-with-php/ – Azzo May 31 '20 at 07:36

0 Answers0