Ajax and mysql_close() is not a valid link resource

Hi guys I am calling the function below using AJAX and I am returning the data correctly but it also shows a warning - mysql_close() is not a valid link resource etc etc.

I am not really sure what I am doing wrong, I am using the E-commerce CMS Opencart so I guess there must be something deep down in the CMS which does not like me accessing the database with AJAX.

I tracked down the line in the engine which is in the warning and it is just doing :

 public function __destruct()
 {
	mysql_close($this->connection);
}

I am sure that I could do this manually by writing the DB call directly in my function but I wanted to preserve the MVC structure so as you can see, I am instantiating the module object and calling the model class where I have put the DB call.

Can anyone tell me how to avoid this happening every time I call db data using AJAX?

thanks


	public function FindYourDeal() {

            $this->load->model('tool/filter');
	    $multi = $this->model_tool_filter->FindYourDeal();

                   $i = 0;
                   foreach($multi as $value)
                   {
                   foreach($value as $key => $subvalue)
                     {
                           if($i % 2 == 0)
                           {
                             $concat = $subvalue;
                          }
                          else
                          {

                           $data[$i] = $subvalue." : ".$concat;
                          }

                          $i ++;
                      }
                  }


          print_r ($this->array_duplicates_values($this->normalize_array($data)));

	print"successfully called!";
	}