Welcome Guest, Not a member yet? Register   Sign In
How can I use findAll with select in model?
#2

Code:
// Method inside your controller

    public function dbtest()
    {
        $model = model('MyModel');
        
        $builder = $model->builder();
        $builder->select('column1, column2');

        $result = $model->findAll();
        var_dump($result);        
    }

This is tested and produces a result set without error.

However, after getting your code to work you would be better off creating a method in your model and returning your results rather than manipulating the database logic from within your controller.
Reply


Messages In This Thread
RE: How can I use findAll with select in model? - by [email protected] - 04-06-2021, 06:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB