mysqli::query returns true on SELECT statement

Posted by Travis Pessetto on Stack Overflow See other posts from Stack Overflow or by Travis Pessetto
Published on 2012-11-28T17:00:46Z Indexed on 2012/11/28 17:04 UTC
Read the original article Hit count: 163

Filed under:
|
|

I have an application that reads in one of its classes:

public function __construct()
{
  global $config;
  //Establish a connection to the database and get results set
  $this->db = new Database("localhost",$config["dbuser"],$config["dbpass"],"student");
  $this->records = $this->db->query("SELECT * FROM major") or die("ERROR: ".$this->db->error);
  echo "<pre>".var_dump($this->records)."</pre>";
}

My problem is that var_dump shows that $this->records is a boolean. I've read the documentation and see that the SELECT query should return a result set. This is the only query used by the application.

Any ideas where I am going wrong?

© Stack Overflow or respective owner

Related posts about php

Related posts about php5