1

When I try this

$this->db->query('SELECT * FROM WMY_VIEW WHERE id_bla = ? 
ORDER BY bla, blabla', array($bla))->result_array();

I'm getting this error

Query error: ERROR:  relation "WMY_VIEW" does not exist.

WMY_VIEW is a sql-view, not a table. BUT in regular php, it works

$sql = "SELECT * FROM WMY_VIEW WHERE id_bla=".$bla." ORDER BY bla, blabla";
$results = pg_query(CONEXION, $sql);

What's the problem with CI? What I'm missing?

PS: Database (PostgreSQL) it's not mine.

Hector
  • 129
  • 16

1 Answers1

3

Try this

$this->db->where('id_bla',$id_bla);
$this->db->order_by('bla','desc');
$query = $this->db->get('WMY_VIEW');
return $query->result_array();