Welcome Guest, Not a member yet? Register   Sign In
Call to a member function insert() on string
#1

(This post was last modified: 04-22-2023, 02:16 AM by byoosdigital.)

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
Reply
#2

(This post was last modified: 04-21-2023, 07:22 PM by kenjis.)

See https://www.codeigniter.com/user_guide/d...refixtable

I recommend you read
https://www.codeigniter.com/user_guide/m...model.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB