XAMPP fatal error hatası

serbesyigit13

Decapat
Katılım
1 Şubat 2023
Mesajlar
151
Daha fazla  
Cinsiyet
Erkek


Merhaba görseldeki gibi bir hata alıyorum aşağıya islem.phpdeki kodları da bırakıyorum.

 
sql sorgusunda kullanici_tc değerinin null yani boş olamayacağını söylüyor.
PHP:
<?php

ob_start();
session_start();
include 'baglan.php';

if (isset($_POST['kullanicikaydet'])) {
    $kullanici_tc = isset($_POST['kullanici_tc']) ? $_POST['kullanici_tc'] : null;
    $kullanici_adsoyad = isset($_POST['kullanici_adsoyad']) ? $_POST['kullanici_adsoyad'] : null;
    $kullanici_password = isset($_POST['kullanici_password']) ? $_POST['kullanici_password'] : null;

    // "kullanici_tc" boş mu kontrol et
    if ($kullanici_tc === null) {
        die('TC Kimlik Numarası boş olamaz.');
    }

    // Veritabanı ekleme işlemi
    $sorgu = $db->prepare('INSERT INTO kullanici SET
        kullanici_tc = ?,
        kullanici_adsoyad = ?,
        kullanici_password = ?');

    $ekle = $sorgu->execute([
        $kullanici_tc,
        $kullanici_adsoyad,
        $kullanici_password
    ]);

    if ($ekle) {
        header('Location: index.php?durum=basarili');
        exit;
    } else {
        $hata = $sorgu->errorInfo();
        echo 'MySQL hatası: ' . $hata[2];
    }
} else {
    echo 'Form gönderilmedi.';
}
 
Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hastane_otomasyon.randevular' doesn't exist in C:\xampp\htdocs\hastane_otomasyon\islem.php:68 Stack trace: #0 C:\xampp\htdocs\hastane_otomasyon\islem.php(68): PDOStatement->execute(Array) #1 {main} thrown in C:\xampp\htdocs\hastane_otomasyon\islem.php on line 68
PHP:
<?php
ob_start();
session_start();
include 'baglan.php';

if(isset($_POST['kullanicikaydet'])) {
    $kullanici_tc = isset($_POST['kullanici_tc']) ? $_POST['kullanici_tc'] : null;
    $kullanici_adsoyad = isset($_POST['kullanici_adsoyad']) ? $_POST['kullanici_adsoyad'] : null;
    $kullanici_password = isset($_POST['kullanici_password']) ? $_POST['kullanici_password'] : null;

    //veritabanı ekleme İşlemi
    $sorgu = $db->prepare('INSERT INTO kullanici SET
        kullanici_tc = ?,
        kullanici_adsoyad = ?,
        kullanici_password = ?');

        $ekle = $sorgu->execute([
            $kullanici_tc, $kullanici_adsoyad, $kullanici_password
        ]);
        if($ekle) {
            header('location: index.php?durum=basarili');
        } else{
           $hata = $sorgu->errorInfo();
           echo 'mysql hatası' .$hata[2];
        }
}

if(isset($_POST['giris_yap'])) {
    $kullanici_tc = $_POST['kullanici_tc'];
    $kullanici_password = $_POST['kullanici_password'];

    $kullanicisor = $db->prepare("SELECT * FROM kullanici WHERE kullanici_tc=:kullanici_tc and
    kullanici_password=:kullanici_password");
    $kullanicisor->execute([
        'kullanici_tc' => $kullanici_tc,
        'kullanici_password' => $kullanici_password
    ]);

    $say = $kullanicisor->rowCount();

    if ($say==1) {
        $_SESSION['userkullanici_tc']=$kullanici_tc;
        header('location: anasayfa.php?durum=girisbasarili');
        exit;
    } else{
        header('location: index.php?durum=basarisizgiriş');
        exit;
    }
}

if(isset($_POST['randevu_kaydet'])) {
    $sehir = isset($_POST['sehir']) ? $_POST['sehir'] : null;
    $hastane = isset($_POST['hastane']) ? $_POST['hastane'] : null;
    $doktor = isset($_POST['doktor']) ? $_POST['doktor'] : null;
    $tarih = isset($_POST['tarih']) ? $_POST['tarih'] : null;
    $klinik = isset($_POST['klinik']) ? $_POST['klinik'] : null;
    $hasta_id = isset($_POST['kullanici_id']) ? $_POST['kullanici_id'] : null;

    $kaydet=$db->prepare("INSERT INTO randevular SET
        sehir = ?,
        hastane = ?,
        doktor = ?,
        tarih = ?,
        klinik = ?,
        randevu_hasta_id = ?
    ");

    $insert=$kaydet->execute([
        $sehir, $hastane, $doktor, $tarih, $klinik, $hasta_id
    ]);
    if($insert) {
        header("location:anasayfa.php?kayıt_basarili");
    } else{
        header("location:anasayfa.php?kayıt_basarisiz");
    }

}


?>
şuan bu hatayı alıyorum hocam kodlar aşağıda
 
hastane_otomasyon.randevular isimde bir tablo bulunamadığı için hata alıyorsunuz adını yanlış yazmış olabilirsiniz dikkatle tekrar inceleyin
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için çerezleri kabul etmelisiniz. Daha Fazlasını Öğren.…