Welcome Guest, Not a member yet? Register   Sign In
What's the difference of these two ways of handle DB data?
#1

Hi!

I have a question about using the methods of query builder. I found everywhere examples that looks like very much to the code below:

Code:
$this->db->insert('ST_ITM', $data);

However I couldn't make it work in any way and also didn't find any complete example showing how to use it.

What I managed to work for me was the example below that I picked from CI official documentation in their website:

PHP Code:
$db = \Config\Database::connect();
$builder $db->table('news');
$result $builder->insert($news); 

And that I called from:

PHP Code:
$modelo = new NewsModel();
$result $modelo->saveNews($dados); 

Someone could please explain me how the first method works or point me to a complete example that shows that?

Thanks!
Recovering the wasted time...
Reply
#2

It's because you find CodeIgniter 3 based answers.
https://codeigniter.com/userguide3/datab...rting-data
Reply
#3

(04-25-2020, 04:44 PM)jreklund Wrote: It's because you find CodeIgniter 3 based answers.
https://codeigniter.com/userguide3/datab...rting-data

Oh, I got it! Blush

Thank you very much!
Recovering the wasted time...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB