example i have 3 article each article have button "read more". and i am getting 1 article have array like this.
Dump => object(stdClass)#21 (6) {
["id"] => string(2) "76"
["id_admin"] => string(0) ""
["judul_berita"] => string(5) "kasus"
["content"] => string(449) "
This is my first use of nestedsortable.js in a custom cms creation with codeigniter, So I use it with Codeigniter php framework. I have an ordered and nested list(for order pages) and I need to convert this list to array with 'toArray' but it's not working the error message: uncaught typeError: Cannot call method 'match' of undefined this is my js code:
"
["tanggal"] => string(10) "2014-03-25"
["slug"] => string(5) "kasus"
}
and 2 other article like this
Dump => array(0) {
}
where is error code?
my controller
public function index($id = null, $slug = FALSE){
// Fetch the article
$this->db->where('pubdate <=', date('Y-m-d'));
$this->data['article'] = $this->mberita->get_by_id($id,$slug);
dump($this->data['article']);
}
my model
function get_by_id($id, $slug)
{
return $this->db->get_where($this->tbl_berita, array('id' => $id, 'slug' => $slug),1)->row();
}
please help me what to do. thank you.
please check this code any wrong in there?
// Redirect if slug was incorrect
$requested_slug = $this->uri->segment(3);
$set_slug = $this->data['article']->slug;
if ($requested_slug != $set_slug) {
redirect('article/' . $this->data['article']->id . '/' . url_title($this->data['article']->slug), 'location', '301');
}
I think its because row() retrieves a single row. better use fetch_object
or any other method.
You can know more about this in codeigniter documentation- here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.