Welcome Guest, Not a member yet? Register   Sign In
Select All from datebase
#1

[eluser]Gabi3xz[/eluser]
Datebasee access
Code:
public function select_article($id) {
  
   $q = $this
            ->db
            ->select('article_title', 'article_description', 'article_keywords', 'article_content')
            ->where('id', $id)
            ->limit(1)
            ->get('article');

      if ( $q->num_rows > 0 ) {
         // person has account with us
         return $row = $q->row();
      }
      return false;
        
}

and call function
Code:
$this->load->model('call_db');
$result = $this->call_db->select_article($id);  
    
print_r($result);
I ensue a single value "Class Object ( [article_title] => title )"
Why?
I have four values in datebase.

My table from datebase http://img822.imageshack.us/img822/1391/asssiu.jpg.
#2

[eluser]Oscar Dias[/eluser]
The select should contain only one string with the values. Should be like this:
Code:
$q = $this
            ->db
            ->select('article_title, article_description, article_keywords, article_content')
            ->where('id', $id)
            ->limit(1)
            ->get('article');
The official reference: http://ellislab.com/codeigniter/user-gui...tml#select




Theme © iAndrew 2016 - Forum software by © MyBB