CodeIgniter Forums
page count - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: page count (/showthread.php?tid=42155)



page count - El Forum - 05-27-2011

[eluser]vanika[/eluser]
Hello, this is my first post in this forum ))

please tell me what problem do i have

controller news.php

Code:
public function show($id)
        {
            
            $data = array();
            $data['main_text'] = $this->news_model->get($id);
    
            $counter = array('view' => $data['main_text']['view'] + 1);
            $this->news_model->update_counter($id, $counter);
            
            $this->news_lib->show($data);
        }


model - news_model.php

Code:
public function get($id)
        {
            $this->db->where('id', $id);
            $query = $this->db->get('news');
            
            return $query->row_array();
            
            
        }
        
        public function update_counter($id, $counter)
        {
            $this->db->where('id', $id);
            $this->db->update('news', $counter);
        }

this one works for me but every time i open any news item i have symbols like this:

Code:
1
1

1 || 1



� || �
<
<

< || <
<
<

< || <



� || �
3
3

3 || 3
g
g

g || g

instead of text.

version 2:

if i change the row_array to result_array in news_model.php text works fine but not works page count and i have error message like this:

Quote:Message: Undefined index: view

Filename: controllers/news.php

Line Number: 31

line 31:

Code:
$counter = array('view' => $data['main_text']['view'] + 1);

any ideas? )

thx.


page count - El Forum - 05-28-2011

[eluser]vanika[/eluser]
Upp!!


page count - El Forum - 05-28-2011

[eluser]InsiteFX[/eluser]
And what does this method look like?
Code:
$this->news_lib->show($data);
Your not really explaining on what your trying to do here!

InsiteFX