Welcome Guest, Not a member yet? Register   Sign In
Upgrade Model CI3 to CI4
#1

(This post was last modified: 02-14-2021, 04:57 AM by cloude.)

Hi all.
I'm trying to upgrade CI3 to CI4 adding namespace and use,
but Visual Studio code get 'Undefined method select'. 

Thanks in advance for help.


PHP Code:
namespace App\Models// CI4

use CodeIgniter\Model// CI4

defined('BASEPATH') OR exit('No direct script access allowed');

class 
myClass extends Model {

    public function myFunc()
    {

        $this->db->select('id, name'); // <-- UNDEFINED METHOD SELECT
        $this->db->from('table');
        $this->db->where('status'1);
        $this->db->where('op''');
        $this->db->group_start();
            $this->db->where('data_cal'NULL);
            $this->db->or_where('data_cal <= NOW()');
        $this->db->group_end();
        $this->db->order_by("id""DESC");

        $query =  $this->db->get()->result();
        
        
if($query) {

            return $query[0];

        } else {
            null;
        }
    }


Reply


Messages In This Thread
Upgrade Model CI3 to CI4 - by cloude - 02-14-2021, 04:39 AM
RE: Upgrade Model CI3 to CI4 - by iRedds - 02-14-2021, 09:32 AM
RE: Upgrade Model CI3 to CI4 - by wdeda - 02-14-2021, 09:43 AM
RE: Upgrade Model CI3 to CI4 - by Chivinsdev - 02-16-2021, 01:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB