[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.