Welcome Guest, Not a member yet? Register   Sign In
Why are we saying SLUG = FALSE?
#3

Thank you. Ah, of course, I overlooked the existence of 'return'.

1. Can I do something like this? Just to retrieve all data. I dont have to use $slug?
Code:
public function get_news()
{

$query = $this->db->get('news');
return $query->result_array();

}

2. By saying like this get_news($slug = FALSE) wer are not setting $slug to false? $slug is not boolean, we are just checking if it exists?

3. Im just confused by the use of get_news($slug = FALSE) and then checking if ($slug===FALSE). So if $slug doesnt exist then it will be false because it is the default argument, but if it exists then the query outside of if curly braces will be executed. That's my understanding now.
Reply


Messages In This Thread
Why are we saying SLUG = FALSE? - by lexxtoronto - 03-18-2015, 01:12 PM
RE: Why are we saying SLUG = FALSE? - by mwhitney - 03-18-2015, 01:25 PM
RE: Why are we saying SLUG = FALSE? - by lexxtoronto - 03-18-2015, 01:55 PM
RE: Why are we saying SLUG = FALSE? - by CroNiX - 03-18-2015, 02:27 PM
RE: Why are we saying SLUG = FALSE? - by mwhitney - 03-19-2015, 08:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB