Database failed to connect!

Can somebody help me to get a cms website online. I did all the steps , I published the files to public_html. I created a local database and a webhost database. But I don’t know where to put the username, the database name and the host name ( localhost). Thanks for your help !

Try out this code, replace the places you have to replace

<?php

 error_reporting( ~E_DEPRECATED & ~E_NOTICE );
 
 define('DBHOST', 'localhost');
 define('DBUSER', 'replace.this');
 define('DBPASS', 'this.too');
 define('DBNAME', 'and.this');
 
 $conn = mysqli_connect(DBHOST,DBUSER,DBPASS);
 $dbcon = mysqli_select_db($conn,DBNAME);
 
 if ( !$conn ) {
  die("Connection failed : " . mysqli_error());
 }
 
 if ( !$dbcon ) {
  die("Database Connection failed : " . mysqli_error());
 }
?>

Thanks for your help but when I use that script I got this message :

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /storage/ssd1/985/2238985/public_html/index.php:54 Stack trace: #0 {main} thrown in /storage/ssd1/985/2238985/public_html/index.php on line 54

Before that I exported the local database and import it in the server database. Did I do well ? What shoul I do to get connect with the server database ? Thanks in advance.

Please lower your php version

2 posts were split to a new topic: Remote MySQL connection