• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem

#1
please clear my doubt: is ($slag=false)  ??


public function get_news($slug = FALSE)
{ if ($slug === FALSE)
        {
                $query = $this->db->get('news');
                return $query->result_array();
        }

        $query = $this->db->get_where('news', array('slug' => $slug));
        return $query->row_array();
}
Reply

#2
(03-03-2016, 10:00 PM)saumya gupta Wrote: please clear my doubt: is ($slag=false)  ??


public function get_news($slug = FALSE)
{ if ($slug === FALSE)
        {
                $query = $this->db->get('news');
                return $query->result_array();
        }

        $query = $this->db->get_where('news', array('slug' => $slug));
        return $query->row_array();
}

It's default value for $slug if it wasn't specified when the method called.
http://php.net/manual/en/functions.argum...ts.default
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.