i have written a query like this in php, it takes a long time to load, considering there are only 150 students
any idea why?
Code: Select all
<?php
$family_list_all = ARRAY();
$sql_schools_to_doP = "select scid,tbl_student.frn_familyid from tbl_school,tbl_student where tbl_student.frn_scid = tbl_school.scid and tbl_school.frn_lid = 88 and sc_status = 1 and sc_type = 'school' and ((tbl_student.stu_status = 1) or (tbl_student.stu_status = 3 and tbl_student.stu_tid != 0)) order by stu_dob asc";
$mysql_result_schools_to_doP = mysql_query($sql_schools_to_doP);
$num_rows_schools_to_doP = mysql_num_rows($mysql_result_schools_to_doP);
while ($row = mysql_fetch_array($mysql_result_schools_to_doP))
{
$scidp = $row["scid"];
$frn_familyid = $row["frn_familyid"];
$sql_siblingP = "select tbl_student.stuid as older_stuid,stu_fname1,stu_lname from tbl_student where frn_familyid = $frn_familyid and ((tbl_student.stu_status = 1) or (tbl_student.stu_status = 3 and tbl_student.stu_tid != 0)) order by tbl_student.stu_dob asc";
$mysql_result_siblingP = mysql_query($sql_siblingP);
$num_rows_siblingP = mysql_num_rows($mysql_result_siblingP);
$get_siblingP = mysql_fetch_assoc($mysql_result_siblingP);
array_push($family_list_all, $frn_familyid);
}
}
?>