Code: Select all
<?php
require_once("MDB2.php");
Class RetrieveDataManager
{
private $db;
public function __Construct()
{
$dsn = array ('phptype' =>'mysqli', 'hostpec' =>'localhost:3306', 'username'=>'root', 'password'=>'admin', 'database'=>'realkzeal', 'client_flags'=>65536);
$this->db =& MDB2::factory($dsn, true);
if (PEAR::isError($this->db))
trigger_error($this->db->getMessage().$this->db->getUserinfo());
$this->db->loadModule('Function');
}
function getCityByName($cityName)
{
$quoteCityName =
$queryString =array( $this->db->quote($cityName));
$getCityName = $this->db->executeStoredProc('RKzeal_GetCityByName', $queryString);
while($theCityName = $getCityName->fetchRow(MDB2_FETCHMODE_ASSOC ))
{
echo $theCityName['City']."\n";
}
if(PEAR::isError($getCityName))
trigger_error($getCityName->getUserinfo());
print_r($theCityName['City']);
}
}
$myCity = new RetrieveDataManager();
$myCity ->getCityByName('Idumota');
?>