Welcome Guest, Not a member yet? Register   Sign In
foreach in models and controller
#8

(07-08-2015, 04:48 AM)kenjis Wrote:
(07-08-2015, 02:47 AM)StratoKyke Wrote:
(07-08-2015, 01:41 AM)kenjis Wrote: Don't use `echo` in model.

What should I use?

If you call `echo`, it outputs at the moment.
So you should call echo only in views (but it seems you don't use views).

You have to return data from model, instead of echo.


I can try edit in this way:


PHP Code:
public function info_server($name) {
        
$db $this->load->database('site'TRUE);
        
$db    ->select('value')
 
                       ->from('arcor_server_setting')
            ->
where('name'$name);
        
$query_info_view $db->get('');
        foreach (
$query_info_view->result() as $row){
            return 
$row->value;
        }
    } 


But in this way It does not work anyway. I do not print variables above code, but it makes me even use.
Reply


Messages In This Thread
foreach in models and controller - by StratoKyke - 07-07-2015, 06:39 PM
RE: foreach in models and controller - by kenjis - 07-08-2015, 01:41 AM
RE: foreach in models and controller - by kenjis - 07-08-2015, 04:48 AM
RE: foreach in models and controller - by StratoKyke - 07-08-2015, 04:51 AM
RE: foreach in models and controller - by kenjis - 07-08-2015, 05:07 AM
RE: foreach in models and controller - by kenjis - 07-08-2015, 05:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB