Ads

How to Fix Overcoming Failed in 000webhost database connection



Black and Gray Laptop Computer

Alright on this occasion today I will share a moment that I used to feel when connecting a database from 000webhost. I tried various ways to overcome this and yes no one can answer then I found an oddity in my website database. What is that ? let's discuss.

1. Why problems occur there are 2 things that can happen. The first is located in your connection.php script and the second is located in the settings when you create the database.
2. The first way you can do is try to open your php connection and replace it with the script below.
<?php
$servername = "localhost";
$database = "namadatabase";
$username = "user";
$password = "passworddatabase";




// untuk tulisan bercetak tebal silakan sesuaikan dengan detail database Anda// membuat koneksi$conn = mysqli_connect($servername, $username, $password, $database);
// mengecek koneksiif (!$conn) {



    die("Koneksi gagal: " . mysqli_connect_error());
}
echo "Koneksi berhasil";
mysqli_close($conn);
?>
3. If it is successful it means there is no problem in your database but if you are not successful it means there is a possibility of something wrong in your database, why? Take a look when you create a database from 000webhost. Are the users and database names you entered the same?


4. If so, I suggest you delete the database. because of what? try to notice the db and db user names exactly. it crashes your database.
5. If you have deleted it, please create a new database with a different database name from the user name.
6. Please change the connection file with the name and db user you just created.


0 Response to "How to Fix Overcoming Failed in 000webhost database connection"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel