$strSQL="SELECT DISTINCT up_id FROM process where year=($year) and term=($term)";
$objQuery = mysqli_query($con,$strSQL);
$check = array();
while ($row_user = mysqli_fetch_assoc($objQuery))
$userinfo[] = $row_user;
foreach($userinfo as $up_id) {
@$strSQL="SELECT UserID,up_id,Mean,year,term FROM process WHERE up_id='".$up_id[up_id]."'";
$strSQL.="AND year=$year and term=$term ORDER BY Mean DESC";
$objQuery = mysqli_query($con,$strSQL);
$num=mysqli_num_rows($objQuery);
for($i=1;$i<=$num;$i++)
{
$row=mysqli_fetch_array($objQuery);
// Show
// echo "ลำดับที่ ".$i.". ";
// echo $row['UserID']." ";
// echo $row['up_id']."<br \>ปี ";
// echo $row['year']." || เทอม";
// echo $row['term']."<br \>";
// echo $row['Mean']."<br \>";
// INSERT TO DB
$strSQL = "INSERT INTO ranking ";
$strSQL .="(UserID,up_id,Mean,rank,year,term) ";
$strSQL .="VALUES ";
$strSQL .="('".$row['UserID']."','".$row['up_id']."','".$row['Mean']."','".$i."' ";
$strSQL .=",'".$year."','".$term."') ";
$objQuery = mysqli_query($con,$strSQL);
}
}
จาก Code ด้านบนขึ่นข้อความด้านล่างนี้ครับ
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\ProjectN\admin\ranking2.php on line 58