class Baglan {
private $sunucu = "locahost";
private $veritabani = "uye";
private $kullanici = "root";
private $sifre = "";
public function baglanti() {
try {
$vt = new PDO('mysql:host='.$this->sunucu.';dbname='.$this->veritabani, $this->kullanici, $this->sifre);
}catch(PDOExeption $e) {
echo "Hata :" . $e->getMessage();
}
}
class siteayar extends Baglan {
public $sitead;
public $sitelogo;
public function ayarlar() {
$verial=$vt->prepare("select * from siteayar where sira=:siral order by sira asc limit 1");
$verial->("sira"=>1);
$dongu=$verial->fetch(PDO::FETCH_ASSOC);
$this->sitelogo=$dongu["logo"];
}
}
}
?>
Kullanım şekli ise
$vtbaglan = new Baglan();
$sonuc = $vtbaglan->baglanti();