Questo è tutto quello che c'è dentro la cartella class.db.php non so di preciso cosa devo modificare :
<?phpclass db
{
private $db = NULL;
private $host = NULL;
private $user = NULL;
private $password = NULL;
private $port = NULL;
public function __construct($host, $user, $password, $port)
{
$this->host = $host;
$this->user = $user;
$this->password = $password;
$this->port = $port;
}
private function initDb(){
if($this->db == NULL){
try
{
$this->db = new PDO( 'mysqlort='.$this->port.';host='.$this->host, $this->user, $this->password);
}
catch (Exception $e)
{
exit('Sito in manutenzione.');
}
}
}
public function query($array)
{
$this->initDb();
$sql = $array['sql'];
$par = (isset($array['par'])) ? $array['par'] : array();
$ret = (isset($array['ret'])) ? $array['ret'] : 'res';
$this->db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
$obj = $this->db->prepare($sql);
$result = $obj->execute($par);
if (!$result) exit("Errore Query");
switch ($ret)
{
case 'fetch-assoc':
return $obj->fetch(PDO::FETCH_ASSOC);
break;
case 'fetch-all':
return $obj->fetchAll(PDO::FETCH_ASSOC);
break;
case 'result':
return $result;
break;
default:
return $result;
break;
}
}
public function __destruct() { $this->db = NULL; }
}
?>
PS: Un altra cosa ,il mio provider non mi da la porta del database , però qua la chiede
Poi c'è anche un altro file chiamato config.php che ha gia dei parametri di un database che non è il mio .. grazie mille

ort='.$this->port.';host='.$this->host, $this->user, $this->password);
Rispondi quotando
