Welcome Guest, Not a member yet? Register   Sign In
How to handle eror message in controller ?
#2

[eluser]Fireclave[/eluser]
Code:
public function pages($id = false)
    {
        if($id)
        {
            $query = $this->db->query("SELECT * FROM myTable WHERE myKey='".$id."'");
            $data['pages']= $query->result();
            $data['prm']  = '';
            $data['mode'] = 'pages';
            $this->load->view('template',$data);
        }
        else
        {
            // Do something
        }

    }

What do you thing about this ?

You can set an default value (in this case false). Then you check the value by an if statement.


Messages In This Thread
How to handle eror message in controller ? - by El Forum - 08-13-2011, 08:01 AM
How to handle eror message in controller ? - by El Forum - 08-13-2011, 08:29 AM
How to handle eror message in controller ? - by El Forum - 08-13-2011, 08:30 AM
How to handle eror message in controller ? - by El Forum - 08-13-2011, 09:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB