Function codeigniter with sql

Asked

Viewed 73 times

-1

I have a function called tires on the codeigniter model

And in the same model I have another function I need to call the function Cod tires

Can someone tell me how I do it here an example of what I want to do...

$this->db->where('xcod1 = ', $this->pneus->cod);

  • Are you accessing the table? You don’t need to specify the DB table

  • It was not clear what the problem is, could explain better and put the important parts of the model?

  • Let’s say sql is this : $this->db->Where('xcod1 = ', Here I want to get a Cod); And this Cod comes from another function so I want to know how I can get it done using $this->featureName->Cod;

  • Make the function return the value, then pass it forward.

  • And how do I pass her ?

1 answer

0

The model of CI it serves only for communication with DB, who manage and calls the functions are the controller

Well in your job:

$this->db->where('xcod1 = ', $this->pneus->cod);

the correct would be, without the sign of "=" being like this:

$this->db->where('xcod1', $this->pneus->cod);

but where the object comes from tires, I believe you’re there!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.