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

[eluser]Edy S[/eluser]
[quote author="Fireclave" date="1313263751"]
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.[/quote]

Hi Fireclave, thanks for your post ...
It work well, now that i can redirect to other page while found an empty $id.
To CI_adis i've read it
Code:
note that this is just not in codeigniter but throughout php in case you were wondering
I thought that i should learn more about php function Smile
Thanks for you all Smile


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