norecord case returning from model to controller-view. thanks!!! appreciate! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: norecord case returning from model to controller-view. thanks!!! appreciate! (/showthread.php?tid=20857) |
norecord case returning from model to controller-view. thanks!!! appreciate! - El Forum - 07-23-2009 [eluser]artlover[/eluser] Hi, here is my model. I want to display an upload form at view if there is no record. what can I return to controller for no record case? now i made a silly $data[] = 0. and i have no control at viewer to create an if condition for upload form :/ appreciate helps!! thanks Code: function get_img_id_record($id_work) { norecord case returning from model to controller-view. thanks!!! appreciate! - El Forum - 07-23-2009 [eluser]wowdezign[/eluser] I usually do something like: Code: function get_img_id_record($id_work) { norecord case returning from model to controller-view. thanks!!! appreciate! - El Forum - 07-23-2009 [eluser]wowdezign[/eluser] Then in your controller you can do something like: Code: if($this->ModelName->get_img_id_record('id_number')){ If I understood you correctly that is. norecord case returning from model to controller-view. thanks!!! appreciate! - El Forum - 07-24-2009 [eluser]artlover[/eluser] yes thats working great thanks!! ps, how can I return num_rows from same model? with a different array like $data_num[]? or any better way? thanks!!! norecord case returning from model to controller-view. thanks!!! appreciate! - El Forum - 07-24-2009 [eluser]artlover[/eluser] is there any way to return a string from model to view? for example I have $str=2 at model, and how can I pass this string to view? norecord case returning from model to controller-view. thanks!!! appreciate! - El Forum - 07-24-2009 [eluser]wowdezign[/eluser] Without seeing the whole model it's hard to tell what's actually happening in the code, but one way is to assign the string to a member variable of the model and then write a method that returns the value of that member variable. Code: class SomeModel extends Model(){ |