我在while循环中初始化一个数组变量,问题是当这个数组变量打印出while循环时,那么数组没有显示,当这个数组变量在循环中打印时,数组就会显示出来.
<?php
$all_rollno="";
//Get Current Session
$Res_Sess = mysql_query("SELECT sessionid from tbl_session where status=1 ORDER BY sessionid desc limit 1");
$Row_Sess = mysql_fetch_array($Res_Sess);
$Session = $Row_Sess[0];
//Get Batch
$Res_Bat = mysql_query("SELECT batchid,batchname,code FROM tbl_batch where status=1 and batchid!=12 ORDER BY batchid asc");
while($Row_Bat = mysql_fetch_array($Res_Bat)){
$Batch = $Row_Bat['batchid'];
$Bat_Code = $Row_Bat['code'];
//Present - Attendance
$Patt4 = mysql_query("select count(id),rollno from tbl_attendance where batchid = '$Batch' and sessionid = '$Session' and attend = 1 GROUP by rollno");
$arraytpresent="";
$array_rollno="";
$ipresent=0;
while($Row_P4 = …Run Code Online (Sandbox Code Playgroud)