<?php class createConnection //create a class for make connection { var $host="localhost"; var $username="username"; // specify the sever details for mysql Var $password="password"; var $database="database name"; var $myconn; function connectToDatabase() // create a function for connect database { $conn= mysql_connect($this->host,$this->username,$this->password); if(!$conn)// testing the connection { die ("Cannot connect to the database"); } else { ...