Hy
I hope that I'm opening this topic in the correct section.
I started to study CI_tutorial and now i stopped from many hours by a problem about a news_model.
When run the tutorial's example get the error:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\httpg\application\models\news_model.php:10)
Filename: core/Common.php
Line Number: 570
Backtrace:
A PHP Error was encountered
Severity: Parsing Error
Message: syntax error, unexpected 'public' (T_PUBLIC)
Filename: models/news_model.php
Line Number: 10
Backtrace:
This is the code of news_model.php
Tahnk you for help!
Luigi
<?php
class News_model extends CI_Model
{
public function __construct()
{
$this->load->database();
}
}
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();
}