Welcome Guest, Not a member yet? Register   Sign In
If statements in Controller?
#2

[eluser]jedd[/eluser]
Hi industrial, and welcome to the CI forums.

While I know this is a demo bit of code, I'll throw in a couple of other suggestions too.

First, you'd probably do this instead:

Code:
function foo ()  {
    if (empty($sandals) && empty($id))
    {    
        echo('in else');
    }
    else
    {
        $this->shoes ($sandals, $id);
    }
}

function shoes($sandals, $id)  {
    {
        echo $sandals;
        echo $id;
    }
}

Keep working through example code - there's plenty out there.

The code you posted .. you'd generally put all that in a function, rather than directly into the class as you've shown there.

Don't use closing ?> tags - they'll bite you later. PHP doesn't need them, anyway.


Messages In This Thread
If statements in Controller? - by El Forum - 10-20-2009, 12:27 PM
If statements in Controller? - by El Forum - 10-20-2009, 12:33 PM
If statements in Controller? - by El Forum - 10-20-2009, 01:19 PM
If statements in Controller? - by El Forum - 10-20-2009, 01:37 PM
If statements in Controller? - by El Forum - 10-21-2009, 09:47 AM
If statements in Controller? - by El Forum - 10-21-2009, 11:03 AM
If statements in Controller? - by El Forum - 10-21-2009, 12:31 PM
If statements in Controller? - by El Forum - 10-21-2009, 03:24 PM
If statements in Controller? - by El Forum - 10-22-2009, 06:13 AM
If statements in Controller? - by El Forum - 10-22-2009, 08:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB