I'm working through the CodeIgniter tutorial called "News section" at this link.
https://www.codeigniter.com/user_guide/t...ction.html
All is set up, including the database "news" table, but when I load my page - https://spokaneesl.com/news/ - I get a database error.
In my database.php file, I notice that the dbprefix item has this.
'dbprefix' => 'ci_',
When I remove that prefix and just have
'dbprefix' => '',
then https://spokaneesl.com/news/ is blank. I'm expecting the news items to appear on that page.
Any ideas what I'm doing wrong?
Here's my News_model code. The error says line 12 which is this. -- $query = $this->db->get('news');
<?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();
}
}
https://www.codeigniter.com/user_guide/t...ction.html
All is set up, including the database "news" table, but when I load my page - https://spokaneesl.com/news/ - I get a database error.
In my database.php file, I notice that the dbprefix item has this.
'dbprefix' => 'ci_',
When I remove that prefix and just have
'dbprefix' => '',
then https://spokaneesl.com/news/ is blank. I'm expecting the news items to appear on that page.
Any ideas what I'm doing wrong?
Here's my News_model code. The error says line 12 which is this. -- $query = $this->db->get('news');
<?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();
}
}