Can't connect db to 000 webhosting


#1

Hey guys

I am trying to connect to the database with my php, should I leave the password blank because I tried it with my password and it won’t connect, just show the die message:

?php

$dbservername = “localhost”;
$dbroot = “id6336468_piano011”;
$dbpassword = “”;
$dbdatabase = “id6336468_loginsystem”;

$conn = @mysqli_connect($dbservername, $dbroot, $dbpassword, $dbdatabase) or die(‘Could not connect to database due to maintenance. Please login later…’);


#2

Looks fine here, no you need to use the password.


#3

This is weird… now I am getting this page…


#4

Use the link from 000webhost.com > Manage Database > phpMyAdmin to login.


#5

From this page?


#6

Yes, Manage, phpMyAdmin.


#7

I have but for some reason, it is not working at the moment…

image


#8

Log out of 000webhost.com, log back in usually cures it.


#9

So, my database credentials are correct and I should be able to connect?I have logged out and logged back in and it seems to be working but my page doesn’t look correct…

It should look something like this on my locahost:


#10

Tried changing your PHP version via general settings to what you are running locally?


#11

I am just a beginner here, could you guide me on this? thanks


#12

Login to 000webhost.com > settings> general > Change PHP version


#13

I have found out that I am using version 7.0.6 but it still doesn’t look right


#14

This is very odd indeed as I have checked my code and it looks correct but the CSS doesn’t seem to be working…This is also bizarre… When I tried to logout, it is showing two includes folder but I only have one include folder…


#15

Think you highlighted the error yourself there…

includes/includes ??


#16

I am confused here because I only have one folder called includes in my file…


#17

I think it is my login credentials as I tried to login again with the following information without a password:

<?php

$dbservername = "localhost";
$dbroot = "id6336468_piano011";
$dbpassword = "";
$dbdatabase = "id6336468_loginsystem";

$conn = @mysqli_connect($dbservername, $dbroot, $dbpassword, $dbdatabase) or die('Could not connect to database due to maintenance. Please login later....');

But I got this on my screen:

I got the die message appearing instead…


#18

Replace or die('Could not connect to database due to maintenance. Please login later....')
By or die(mysqli_error($conn))


#19

I have the following error

Warning: mysqli_error() expects parameter 1 to be mysqli, boolean given in /storage/ssd1/468/6336468/public_html/includes/dbh.php on line 8


#20

Are you sure the password is correct?