Welcome Guest, Not a member yet? Register   Sign In
Loading Database result into Class
#1

Hi,

i know that it works cause I saw how it worked but i'm not sure how to reproduce.

The following code shows how i try to Load the result of the database select into the object "Users" so that i get as result only the id of the Database.

Someone a Idea how to do this?
PHP Code:
<?php

class Users {
    public function __construct()
    {
    }

    public $id;

}

class 
home_model extends CI_Model
{
    private $db;

    public function __construct()
    {
        $this->db $this->load->database('default');
    }

    public function p(){
        $this->db $this->load->database('default'true);
        return $this->db->select('*')->get('auth_users')->custom_result_object(Users);
    }

Reply


Messages In This Thread
Loading Database result into Class - by illmaren - 10-23-2019, 11:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB