$installments = "SELECT
SUM( installments.t_fee ) AS paid_fee,
sum(installments.exam_fee) as r_exam,
sum(installments.lib_fee) as r_lib
FROM installments
JOIN student ON student.s_id = installments.s_id
JOIN program ON program.p_id = student.p_id
WHERE installments.paid =1
AND installments.curr_sem ='".$q['sem']."'
AND student.bat_id ='".$_GET['srch']."'
AND installments.s_id='".$q['s_id']."'
AND program.p_id='".$_GET['srch1']."'
AND student.DeleteStatus=0";
$installments = "SELECT installments.curr_sem as semester
FROM installments
JOIN student ON student.s_id = installments.s_id
JOIN program ON program.p_id = student.p_id
WHERE installments.paid =1
AND installments.lib_fee!=0
AND student.DeleteStatus=0";