How to Query MySQL Database Module Could you help help me correct the follow piece of code 

I am getting the following error.

"The website encountered an unexpected error. Please try again later."



public function __construct(Connection $connection) {
    $this-&gt;connection = Database::getConnection();
  }
public function hello($state = '0') {
    $sqlQuery = $connection-&gt;select('pop11', 'C2011')
    -&gt;fields('C2011', array('male', 'female'))
    -&gt;condition('C2011.sCode', '10', '=');
    $data = $sqlQuery-&gt;execute();        
    if ($data) {
        $results = $data-&gt;fetchAll(\PDO::FETCH_OBJ);
        foreach ($results as $row) {
        echo "Field a: {$row-&gt;male}, field b: {$row-&gt;female}";
        }            
    }else{
        return array('#title' =&gt; 'Error', '#markup' =&gt; 'Could not Find. What you are Looking for.',);
    }

}
$connection doesn't exist in the context of hello(). You need to use $this-&gt;connection if you're wanting to use the Connection that's built in your object.