Call to a member function insert() on string |
good evening CI4 coders
I get this error when running the line $success = $builder->insert($data); I'm looking on the formulas but with no real success can you help me? This array $data into model: array(7) {"agent_string"]=> string(70) "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" ["ip"]=> string(9) "127.0.0.1" ["agent_type"]=> string(7) "Browser" ["agent_name"]=> string(7) "Firefox" ["agent_version"]=> string(5) "109. 0" ["referrer"]=> string(94) "http://localhost/1__codeigniter_dev/1__2023/ci4_opensourceospos/ci4_erponline_new/public/login" ["uri"]=> string(93) "http://localhost/1__codeigniter_dev/1__2023/ci4_opensourceospos/ci4_erponline_new/public/home" } the model <?php namespace App\Models; use CodeIgniter\Model; use CodeIgniter\Database\ResultInterface; class Analytics_model extends Model { public function __construct() { $this->db = \Config\Database::connect(); } public function saveUserInfo(){ $success = FALSE; $this->db->transStart(); $data['agent_string'] = ''; .... $builder = $this->db->prefixTable($this->table); //var_dump( $data );die;//BYOOS_tag $success = $builder->insert($data); $this->db->transComplete(); $success &= $this->db->transStatus(); return $success; } Thanks you Gabriel |
Welcome Guest, Not a member yet? Register Sign In |