skip to Main Content

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


  1. As other people pointed out in the comments, your hostname is wrong. Try this:

    enter code here
    
    <?php
    $username = "AmirAman";
    $password = "**********1";
    $hostname = "qatarreal-estate.com"; 
    
    //connection to the database
    $dbhandle = mysql_connect($hostname, $username, $password) 
     or die("Unable to connect to MySQL");
       echo "Connected to MySQL<br>";
    

    Assuming qatarreal-estate.comis the domain you are looking for.

    Edit: If you run the MySQL server locally, use localhost or 127.0.0.1 for the hostname.

    Login or Signup to reply.
  2. DataBase:
    username: amir
    password: ***3
    

    You will need to use these, like the following:

    $username = "amir";
    $password = "***3";
    $hostname = "localhost"; 
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search