Query Builder need help |
Hello,
i cant understand how pass data from controller to model query builder for example i want get one contact card view by query builder where('id', $findid) how pass $findid variable? or i should this done in controller? and second question this below as example written is query builder example or not? If yes why no connection to DB and its working? PHP Code: public function getNews($id = false)
It is not a Query Builder example. It is an example of CodeIgniter\Model.
But it is very confusing because CodeIgniter\Model could use Query Builder's methods. (04-12-2021, 10:34 PM)kenjis Wrote: It is not a Query Builder example. It is an example of CodeIgniter\Model.OK thanks for understand of query builder, maybe you know how i can send $var to query builder? I want to do that in Contacts page i see all contacts its ok and working but i need make on click button to show only one contact card i think i make onclick send $var to query buuilder where('id', $id) and get only one contact card, but i cant understand how to do and correct do, because in controler i can make this working but i know its not correct i need help how send $var from Controller to Model
Do it in the controller point your view button to the controller method and load the data
then send to a new single view. Otherwise you will need to use jQuery ajax for this. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I recommend you read the User Guide:
https://codeigniter4.github.io/CodeIgnit...your-model (04-13-2021, 02:52 AM)kenjis Wrote: I recommend you read the User Guide: Thanks for good way i made by this and its working, one view but multiple way to get data PHP Code: public function index($page = 'page') |
Welcome Guest, Not a member yet? Register Sign In |