Get data arguments - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31) +--- Thread: Get data arguments (/showthread.php?tid=70848) |
Get data arguments - Nome - 06-08-2018 Hi, today I tried to follow the manual, in order to get data from the form, and did not quite understand how to correctly pass the parameter. In my controller: PHP Code: $model->setParam([ When I send 2 arguments in my model: PHP Code: public function setParam($firstParam, $secondParam) { When I send 1 argument in my model, get "operand should contain 1 column(s)"... PHP Code: public function setParam($firstParam) { Looking inside print_r($firstParam); getting Array ( [firstParam] => 67545647f [secondParam] => 654547547554d ) Tell me please what I missed. Thanks. RE: Get data arguments - ciadmin - 06-08-2018 You are calling your model method incorrectly. Your setParam method has two conflicting signatures - one with a single parameter and one with two. Neither of them expects an array, just values. Your call to the method passes an array of parameters as the only parameter. Read your error message! RE: Get data arguments - Nome - 06-09-2018 (06-08-2018, 08:48 AM)ciadmin Wrote: You are calling your model method incorrectly. I noticed this when browsing and if I take them like this: PHP Code: $model->setParam([ But I wanted to learn how to correctly pass multiple values in CI4, because I'm not experienced ( Thanks for the answer! RE: Get data arguments - InsiteFX - 06-09-2018 There's nothing special about passing arguments to php functions/methods. Read this: PHP - Function arguments RE: Get data arguments - Nome - 06-20-2018 (06-09-2018, 09:08 AM)InsiteFX Wrote: There's nothing special about passing arguments to php functions/methods. Thanks! I watched the controller in @lonnieezell "simple-forums" how is the information from the input fields transmitted there, but did not pay attention to getting the arguments to the model... |