How to connect to the database

post image

connecting to the database in TD-CMS is very easy and straightforward

first you'll need to rename "db.sample.php" to "db.php"

this is how "db.sample.php" looks like by default:


$servername = "";
$username   = "";
$password   = "";
$dbname     = "";

// create connection
//$conn = new mysqli($servername, $username, $password, $dbname);
$conn = mysqli_connect($servername, $username, $password ,$dbname);

// Check connection
if (!$conn) {
    die("Connection failed: " . $conn->connect_error);

//echo "<p>connection to the database was successfully</p>";


after you renamed "db.sample.php" to "db.php"

you'll need to follow the next steps.


Step 1: Server name.

replace localhost near "$servername" with the host of your MySQL server


Step 2: User name.

replace root near "$username" with the username of your MySQL server


Step 3: Password.

replace usbw near "$password" with the password of your MySQL server


Step 4: database name.

replace cms near "$dbname" with the database name of your MySQL server


Step 5: Done!

that's it your now connected to your database well done