I'm trying to get the columns name from "users" table in my database using detFieldNames function in codeigniter 4 but something went wrong. Here is the error: Error
Model class:
class UsersModel extends Model
{
public function __construct()
{
$db = \Config\Database::connect();
$this->builder = $db->table('users');
}
function getColumns()
{
$names = $this->db->getFieldNames('users');
foreach ($names as $field) {
echo $field;
}
exit;
}