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?
Post a Comment