function DoktorListele() { $doktorList = array(); try { $baglanti = new VeriTabaniBaglanti(); $conn = $baglanti->pdo_baglanti(); $sorgu = $conn->query("Select *from doktor"); $rows = $sorgu->fetchAll(PDO::FETCH_CLASS); foreach ($rows as $row) { $doktor = new Doktor(); $doktor->setDoktorId($row->id); $doktor->setAd($row->ad); $doktor->setSoyad($row->soyad); $doktor->setDogumTarihi($row->dogumTarihi); $doktor->setEmail($row->email); $doktor->setTel($row->tel); array_push($doktorList, $doktor); } } catch (PDOException $ex) { echo '<p style="color: red;">Bağlantı Kurulamadı</p>'; } finally { if ($conn != null) { $conn = $baglanti->pdo_sonlandir(); } } return $doktorList; }
?> " name="dogumTarihi" required autofocus/></td> </tr> <tr> <td></td> <td><input type="submit" value="Güncelle"></td> </tr> </table> </form> <?php if (isset($_POST['id1'])) { $doktor = new Doktor(); $doktordao = new DoktorDAO(); $doktor->setDoktorId(trim($_POST['id1'])); $doktor->setAd(trim($_POST['ad'])); $doktor->setSoyad(trim($_POST['soyad'])); $doktor->setEmail(trim($_POST['email'])); $doktor->setTel(trim($_POST['tel'])); $doktor->setDogumTarihi(trim($_POST['dogumTarihi'])); $doktordao->DoktorGuncelle($doktor); } ?> </div> </div> </body> </html> <?php $header->footer(); } ob_end_flush();
function profilBilgileri() { //$profilList = array(); try { if (!empty($_SESSION['doktor_id'])) { $profil = new Doktor(); $d = 0; $id = $_SESSION['doktor_id']; $sql = "Select *from doktor where id='{$id}'"; } else { if (!empty($_SESSION['admin_id'])) { $profil = new Admin(); $d = 1; $id = $_SESSION['admin_id']; $sql = "Select *from admin where id='{$id}'"; } } $profil = new Doktor(); $baglanti = new VeriTabaniBaglanti(); $conn = $baglanti->pdo_baglanti(); $sorgu = $conn->query($sql); $sonuc = $sorgu->fetch(PDO::FETCH_LAZY); if ($sonuc) { $profil->setAd($sonuc->ad); $profil->setSoyad($sonuc->soyad); $profil->setEmail($sonuc->email); $profil->setTel($sonuc->tel); $profil->setDogumTarihi($sonuc->dogumTarihi); if (isset($_SESSION['admin_id'])) { $profil->setUsername($sonuc->username); } } else { echo 'Verilere Ulaşılmadı'; } } catch (Exception $ex) { die($ex->getMessage()); } finally { if ($conn != null) { $conn = $baglanti->pdo_sonlandir(); } } return $profil; }