我知道许多用户都会遇到这种类型的错误,而且我确实在发布之前看到了这些帖子。但仍然没有解决我的问题的方法,希望你们能理解。...
file.php
<?php
require_once("dbcontroller.php");
$db_handle = new DBController();
$result="SELECT * FROM do_order";
$resultorder = $db_handle->runSelectQuerys($result);
echo "<table border='1'>
<tr>
<th>order</th>
<th>payment</th>
<th>generate</th>
<th>tracking id</th>
</tr>";
while($row = mysqli_fetch_assoc($resultorder))
{
$id = $row['id'];
echo "<tr>";
echo "<td>" . $row['order_id'] . "</td>";
echo "<td>" . $row['payment_type'] . "</td>";
echo "<td>";
if (empty($row['tracking_id'])) {
echo "<form method='post' action='call3.php'>";
echo "<input type ='hidden' name='id' value='$id'>
<input type ='hidden' name='order_id' value='".$row['order_id']."'>
<input type ='hidden' name='entity_id' value='".$row['entity_id']."'>
<input type='submit'>
</form>";
}
echo "</td>";
echo "<td>" . $row['tracking_id'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
dbcontroller.php
<?php
class DBController {
private $conn = "";
private $host = "localhost";
private $user = "root";
private $password = "";
private $database = "do_management4";
function __construct() {
$conn = $this->connectDB();
if(!empty($conn)) {
$this->conn = $conn;
}
}
function connectDB() {
$conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
return $conn;
}
function runSelectQuery($query) {
$result = mysqli_query($this->conn,$query);
while($row=@mysqli_fetch_assoc($result)) {
$resultset[] = $row;
}
if(!empty($resultset))
return $resultset;
}
function runSelectQuerys($query) {
$result = mysqli_query($this->conn,$query);
while($row=@mysqli_fetch_assoc($result)) {
$resultset[] = $row;
}
if(!empty($resultset))
return $resultset[0];
}
function executeInsert($query) {
//echo $query;die;
$result = mysqli_query($this->conn,$query);
$insert_id = mysqli_insert_id($this->conn);
return $insert_id;
}
function executeUpdate($query) {
$result = mysqli_query($this->conn,$query);
return $result;
}
function executeQuery($sql) {
$result = mysqli_query($this->conn,$sql);
return $result;
}
function numRows($query) {
$result = mysqli_query($this->conn,$query);
$rowcount = mysqli_num_rows($result);
return $rowcount;
}
}
?>
错误:
警告:mysqli_fetch_assoc()期望参数1为mysqli_result,
中给出的数组
我正在使用mysqli。...
请让我知道是否需要更多详细信息。...
请帮助我找到解决方法。...
预先感谢。...