• 17-08-2025, 22:05:41
    #10
    WebKadir adlı üyeden alıntı: mesajı görüntüle
    Güncel değil root@localhost diyor hiçbir hosting root mysql erişimi vermez.
    Hımm evet
    <?php
    // Veritabanı bağlantı ayarları
    $host = 'localhost';
    $db = 'x';
    $user = 'root';
    $pass = 'x';
    $charset = 'utf8mb4';

    $dsn = "mysql:host=$host;dbname=$db;charset=$charset" ;
    $options = [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES => false,
    ];

    try {
    $pdo = new PDO($dsn, $user, $pass, $options);
    // Debug modu için
    if (isset($_GET['debug'])) {
    error_log("Veritabanı bağlantısı başarılı!");
    }
    } catch (PDOException $e) {
    throw new PDOException($e->getMessage(), (int)$e->getCode());
    }

    evet hocam, host localhost yazıyormuş, ne yazacağım oraya?? hosting sağlayıcımın hangi alanını kullanacağım?
  • 17-08-2025, 22:06:29
    #11
    thebestways adlı üyeden alıntı: mesajı görüntüle
    Hımm evet
    <?php
    // Veritabanı bağlantı ayarları
    $host = 'localhost';
    $db = 'x';
    $user = 'root';
    $pass = 'x';
    $charset = 'utf8mb4';

    $dsn = "mysql:host=$host;dbname=$db;charset=$charset" ;
    $options = [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES => false,
    ];

    try {
    $pdo = new PDO($dsn, $user, $pass, $options);
    // Debug modu için
    if (isset($_GET['debug'])) {
    error_log("Veritabanı bağlantısı başarılı!");
    }
    } catch (PDOException $e) {
    throw new PDOException($e->getMessage(), (int)$e->getCode());
    }

    evet hocam, host localhost yazıyormuş, ne yazacağım oraya?? hosting sağlayıcımın hangi alanını kullanacağım?
    veritabanı oluşturup bilgileri gireceksiniz bu kadar
  • 17-08-2025, 22:07:46
    #12
    WebKadir adlı üyeden alıntı: mesajı görüntüle
    veritabanı oluşturup bilgileri gireceksiniz bu kadar
    Oluşturdum ve doldurdum, ama hala aynı hata maalesef