I have these usernames and passwords:
User name: AmirAman
Pin: ****
Password: ***************1
Parallels Plesk: qatarreal
password: *************2
DataBase:
username: amir
password: ***3
When I type this code in index.php
file, it doesn’t work and Internal Server Error appears:
<?php
$username = "AmirAman";
$password = "**********1";
$hostname = "www.qatarreal-estate.";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
thank you for this answers , i tried all possible suggestion , but there are no thing changed , same result appear in this website qatarreal-estate.com.
2
Answers
As other people pointed out in the comments, your hostname is wrong. Try this:
Assuming
qatarreal-estate.com
is the domain you are looking for.Edit: If you run the MySQL server locally, use
localhost
or127.0.0.1
for the hostname.You will need to use these, like the following:
I’m assuming the hostname of the mysql database is local, due to it not being defined in the information and webhosting providers sometimes leave that information out if it’s on localhost.
Also note that you are using mysql_* functions which are considered bad practice and will be removed from PHP in the near future. Better is to use the PDO class or at least mysqli_* functions.