Try the following:
in the db_connect.php file
class db
{
private $con;
function __construct()
{
$this->con = mysql_connect('localhost','root','');
}
public function getDbConnection(){
return $this->con;
}
}
in the abc.php file, syntax errors corrected in $query2 and href
<?php
require_once 'db_connect.php';
$db = new db();
$con = $db->getDbConnection();
mysql_select_db('mask', $con );
$query2 = "select distinct a.name, a.email from patient a,doctor_patient b, doctor c where c.username='".$username."' and c.username=b.doc_name and b.serial_no=a.serial_no and name='".$name."'";
$res2 = mysql_query($query2,$con);
while($row2 = mysql_fetch_array($res2)){
echo "<tr>";
echo "<td> <a href="v_patient.php">" . $row2['name'] . "</a></td>";
echo "<td>" . $row2['email'] . "</td>";
echo "</tr>";
}
echo "";
}
?>
However, you should upgrade your php to version 5 and above and use mysqli and prepared statement for your sql query:
prepared-statements-in-php-and-mysqli/[
^] to prevent sql injection.