0
我正在此警告:警告:mysqli_fetch_assoc()预计参数1被mysqli_result,布尔在C中给出: XAMPP htdocs中 SMS上线 resultprocessing.php 47
mysqli_fetch_assoc()
预计参数1至被mysqli_result,布尔 在C:\xampp\htdocs\sms\resultprocessing.php
给出线47
这里是我的代码:
<?php
$con = mysqli_connect("localhost", "root", "", "test");
if (isset($_POST['search'])) {
$searchquery = $_POST['search'];
$academic = $_POST['academic'];
$next = $_POST['termbegins'];
$term = $_POST['terms'];
$class = $_POST['class'];
$searchquery = preg_replace("#[^a-zA-Z0-9]#i", " ", $searchquery);
if ($term == "one") {
$sql_result = mysqli_query($con,"SELECT DISTINCT * FROM lowerprimaryone WHERE name = '$searchquery'");
}
elseif ($term == "two"){
$sql_result = mysqli_query($con, "SELECT DISTINCT * FROM lowerprimarytwo WHERE name = '$searchquery'");
}
else{
$sql_result = mysqli_query($con, "SELECT DISTINCT * FROM lowerprimarythree WHERE name = '$searchquery'");
}
//$count = mysqli_num_rows($r);
if (!$sql_result || mysqli_num_rows($sql_result) == 0) {
echo "<table border='1'>" . "<thead>
<th>Thirty Percent (30%)</th>
<th>Seventy Percent (70%)</th>
<th>Hundred Percent (100%)</th>
<th>Remarks</th>
</thead>";
echo "<strong style='margin-left: 27%'>NAME:</strong>" . " " .$searchquery . "<strong style='margin-left: 250px'>". $term."</strong>"."<br>";
echo "<p>" ."<strong style='margin-left: 27%'>YEAR:</strong>". " " .$academic . "<strong style='margin-left: 330px'>DATE: ....</strong>" ."</p>" ;
echo "<p>". "<strong style='margin-left: 27%'>NEXT TERM BEGINS: </strong>" . " ". $next . "<strong style='margin-left: 15%'>Class/Form:</strong>" ." ". "$class ". "</p>";
while ($row = mysqli_fetch_assoc($sql_result)) {
$name = $row['name'];
$surname = $row['surname'];
$country = $row['country'];
$language = $row['language'];
//$remark = $row['remarks'];
$id = $row['id'];
if (is_numeric($row['surname']) && is_numeric($row['country']) && is_numeric($row['language']) && is_numeric($row['language'])) {
if (isset($_POST))
$result = (($surname + $country)/40) * 30;
$result2 = (($language)/(100.00)) * 70;
$final = $result + $result2;
if ($final > 79.00) {
$remark = "Excellent";
} elseif ($final > 69.00 && $final < 80.00) {
$remark = "Very Good";
} elseif ($final > 59.00 && $final < 70.00) {
$remark = "Good";
} elseif ($final > 49.00 && $final < 60.00) {
$remark = "Pass";
} elseif ($final > 39.1 && $final < 50.00) {
$remark = "Credit";
} elseif ($final < 39) {
$remark = "Failed";
}
} else {
echo "Enter numeric data for homework, test1, test2 and exams";
}
echo "<tr><td>" . $result . "</td><td>" . $result2 . "</td><td>" . $final . "</td><td>" . $remark . "</td></tr>";
}
echo "</table>";
}else{
print "Nothing Found";
}
}
?>
我已经尝试了这么多的解决方案,但他们没有帮助 –