[Resolvido] PDO rowsCount, erro
Ola Pessoal,
Não estou entendendo porque está dando erro... Olhem...
**Fatal error**: Call to a member function rowCount() on a non-object in **/home/pretechm/public_html/juvi.com.br/admin/pro_list.php** on line **13**
Neste trecho da página.... rowCount() está errado porque?
page.php
if(!isset($enabled)){ $enabled = '1'; }
$datasource = new datasource();
$rows = $datasource->getAllUsers($enabled);
echo $rows->rowCount();
Funciona corretamente para listar no foreach..., mas não funciona para dar o total em número dos resultados...
function.php
public function getAllUser($enabled) {
try {
$stmt = $this->conn->prepare("SELECT doctors_id, first_name, last_name, photo,
online_status, can_invoice, enabled
FROM tbl_users
WHERE enabled = '$enabled'
ORDER BY first_name ASC");
$stmt->execute();
if ($stmt->rowCount() > 0) {
return $stmt->fetchAll();
}
else {
return 0;
}
}
catch(PDOExeption $e) {
http_response_code(500);
sql_error("MYSQL ERROR: " . $e->getMessage() . "<br/>");
}
}Discussão (2)
Carregando comentários...