callshakeel
Programmer
plz help me,
i want to display records of more than 500 person in a table of 500 * 25 ,but while displaying php get slow and gives error and don't print all records it prints some of them,
If there are less the 100 records in the database it works fine
I'm using IIS server and SQL server for database, i'm fetching the records from two or three databases so i'v to use nested while loop .
i'v increased the Maximum execution time to 120 sec. and increased the virtual paging size.
but still it is not printing and takes too much time to print some of records not all and break and gives error
the code for printing is here.....
$qstr = "SELECT username FROM tblRoles WHERE stu='1'";
$result = $conn->Execute($qstr);
while(!$result->EOF){
$objStu = $result->Fields(0);
$strStu = $objStu->value;
echo "<TR>";
$qstr1 = "SELECT DISTINCT cpi FROM tblPreference WHERE username='$strStu' AND acYearFrom='$strYrFrom' AND semester='$strSem'";
$res1 = $conn->Execute($qstr1);
if (!$res1->EOF){
while(!$res1->EOF){
$objCPI=$res1->Fields(0);
$strCPI=$objCPI->value;
echo "<TD CLASS = \"smallElement\" id=\"$strStu\">$strStu</TD>";
echo "<TD CLASS = \"smallElement\">$strCPI</TD>";
echo "<TD CLASS=\"smallSubTitle\" width=\"0\"></td>";
$res1->MoveNext();
}
}else{
echo "<TD CLASS = \"smallElement\" id=\"$strStu\">$strStu</TD>";
echo "<TD CLASS = \"smallElement\"> </TD>";
echo "<TD CLASS=\"smallsubTitle\" width=\"0\"></td>";
}
$qstr2 = "SELECT workID FROM tblWorks WHERE acYearFrom='$strYrFrom' AND semester='$strSem'";
$res2 = $conn->Execute($qstr2);
while(!$res2->EOF){
$objWork=$res2->Fields(0);
$strWork=$objWork->value;
$qstr3 = "SELECT preference, status FROM tblPreference WHERE username='$strStu' AND WorkID='$strWork'";
$res3 = $conn->Execute($qstr3);
if( !$res3->EOF){
while(!$res3->EOF){
$objPre=$res3->Fields(0);
$strPre=$objPre->value;
$objStatus=$res3->Fields(1);
$strStatus=$objStatus->value;
if ($strStatus == 1){
echo "<TD Class=\"smallElement\" ><font color=\"red\">$strPre</font><input type=\"radio\" id=\"$radioID\" name=\"$strStu\" value=\"$strWork\" onClick=\"selected(null,$NOR,$NOC,$radioID,this.name);\" checked></td>";
echo "<script language=\"javascript\">changeAllotedColor('$strStu')</script>";
$radioID++;
}else{
echo "<TD Class=\"smallElement\" ><font color=\"red\">$strPre</font><input type=\"radio\" id=\"$radioID\" name=\"$strStu\" value=\"$strWork\" onClick=\"selected(null,$NOR,$NOC,$radioID,this.name);\" ></td>";
$radioID++;
}
$res3->MoveNext();
}
}else{
echo "<TD Class=\"smallElement\" ><input type=\"radio\" id=\"$radioID\" name=\"$strStu\" value=\"$strWork\" onClick=\"selected(null,$NOR,$NOC,$radioID,this.name);\"></td>";
$radioID++;
}
$res2->MoveNext();
}
echo "</TR>";
$result->MoveNext();
}
i want to display records of more than 500 person in a table of 500 * 25 ,but while displaying php get slow and gives error and don't print all records it prints some of them,
If there are less the 100 records in the database it works fine
I'm using IIS server and SQL server for database, i'm fetching the records from two or three databases so i'v to use nested while loop .
i'v increased the Maximum execution time to 120 sec. and increased the virtual paging size.
but still it is not printing and takes too much time to print some of records not all and break and gives error
the code for printing is here.....
$qstr = "SELECT username FROM tblRoles WHERE stu='1'";
$result = $conn->Execute($qstr);
while(!$result->EOF){
$objStu = $result->Fields(0);
$strStu = $objStu->value;
echo "<TR>";
$qstr1 = "SELECT DISTINCT cpi FROM tblPreference WHERE username='$strStu' AND acYearFrom='$strYrFrom' AND semester='$strSem'";
$res1 = $conn->Execute($qstr1);
if (!$res1->EOF){
while(!$res1->EOF){
$objCPI=$res1->Fields(0);
$strCPI=$objCPI->value;
echo "<TD CLASS = \"smallElement\" id=\"$strStu\">$strStu</TD>";
echo "<TD CLASS = \"smallElement\">$strCPI</TD>";
echo "<TD CLASS=\"smallSubTitle\" width=\"0\"></td>";
$res1->MoveNext();
}
}else{
echo "<TD CLASS = \"smallElement\" id=\"$strStu\">$strStu</TD>";
echo "<TD CLASS = \"smallElement\"> </TD>";
echo "<TD CLASS=\"smallsubTitle\" width=\"0\"></td>";
}
$qstr2 = "SELECT workID FROM tblWorks WHERE acYearFrom='$strYrFrom' AND semester='$strSem'";
$res2 = $conn->Execute($qstr2);
while(!$res2->EOF){
$objWork=$res2->Fields(0);
$strWork=$objWork->value;
$qstr3 = "SELECT preference, status FROM tblPreference WHERE username='$strStu' AND WorkID='$strWork'";
$res3 = $conn->Execute($qstr3);
if( !$res3->EOF){
while(!$res3->EOF){
$objPre=$res3->Fields(0);
$strPre=$objPre->value;
$objStatus=$res3->Fields(1);
$strStatus=$objStatus->value;
if ($strStatus == 1){
echo "<TD Class=\"smallElement\" ><font color=\"red\">$strPre</font><input type=\"radio\" id=\"$radioID\" name=\"$strStu\" value=\"$strWork\" onClick=\"selected(null,$NOR,$NOC,$radioID,this.name);\" checked></td>";
echo "<script language=\"javascript\">changeAllotedColor('$strStu')</script>";
$radioID++;
}else{
echo "<TD Class=\"smallElement\" ><font color=\"red\">$strPre</font><input type=\"radio\" id=\"$radioID\" name=\"$strStu\" value=\"$strWork\" onClick=\"selected(null,$NOR,$NOC,$radioID,this.name);\" ></td>";
$radioID++;
}
$res3->MoveNext();
}
}else{
echo "<TD Class=\"smallElement\" ><input type=\"radio\" id=\"$radioID\" name=\"$strStu\" value=\"$strWork\" onClick=\"selected(null,$NOR,$NOC,$radioID,this.name);\"></td>";
$radioID++;
}
$res2->MoveNext();
}
echo "</TR>";
$result->MoveNext();
}