Thanks for your help...
After spending several hours, I was able to figure where the error lies. All I posted was actually OK but the method for querying db that is inside load_comments() had lil issues. The line `$this->query_custom()` This is how the query_custom() method looks like...
function query_custom($sql, $params = "")
{
$stmt = $this->con->prepare($sql);
if (isset($params)) {
$stmt->bind_param($params[0], ...$params[1]);
}
$stmt->execute();
$res = $stmt->get_result();
$row = $res->fetch_assoc();
$count = $res->fetch_row();
return [
"result" => $res,
"execute" => $stmt,
"row" => $row,
"count" => $count,
];
}
Since I want to loop through the results with a while loop then I should have left out this line... `$row = $res->fetch_assoc()` and therefore return *$res*. So when I changed it to what I have below, it works as expected.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.