Cannot use object of type mysqli_result as array
Scris: Lun Dec 07, 2020
Salut, m-am lovit de aceasta eroare in scriptul meu...
"Cannot use object of type mysqli_result as array"
in linile
"Cannot use object of type mysqli_result as array"
Cod: Selectaţi tot
<?php
include"header.php";
require_once("include/functii.php");
$perPage = 10;
$page = 1;
if(!empty($_GET["page"])) {
$page = $_GET["page"];
}
$start = ($page-1)*$perPage;
if($start < 0) $start = 0;
$mydb->setQuery("SELECT * from php_interview_questions limit $start,$perPage");
$faq = $mydb->executeQuery();
$nr = $mydb->num_rows($faq);
if(empty($_GET["rowcount"])) {
$_GET["rowcount"] = $nr;
}
$pages = ceil($_GET["rowcount"]/$perPage);
$output = '';
if(!empty($faq)) {
$output .= '<input type="hidden" class="pagenum" value="' . $page . '" /><input type="hidden" class="total-page" value="' . $pages . '" />';
foreach($faq as $k=>$v) {
$output .= '<div class="question">' . $faq[$k]["question"] . '</div>';
$output .= '<div class="answer">' . $faq[$k]["answer"] . '</div>';
}
print $output;
}
?>
Cod: Selectaţi tot
$output .= '<div class="question">' . $faq[$k]["question"] . '</div>';
$output .= '<div class="answer">' . $faq[$k]["answer"] . '</div>';