Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
error perintah koneksi.php
Warning: Use of undefined constant DIR - assumed 'DIR' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\pengiriman_barang\koneksi\koneksi.php on line 2
Warning: require_once(DIR/db_config.php): failed to open stream: No such file or directory in C:\xampp\htdocs\pengiriman_barang\koneksi\koneksi.php on line 2
Fatal error: require_once(): Failed opening required 'DIR/db_config.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\pengiriman_barang\koneksi\koneksi.php on line 2
syntax nya :
<?php
require_once DIR . '/db_config.php';
$conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE);
if (mysqli_connect_errno()) { trigger_error('Koneksi ke database gagal: ' .
mysqli_connect_error(), E_USER_ERROR);
}
?>
2 Jawaban:
<div>Mungkin Ada Kesalahan Di Sini Gan : </div><pre><strong><?php require_once DIR . '/db_config.php'; $conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE); if (mysqli_connect_errno()) { trigger_error('Koneksi ke database gagal: ' . mysqli_connect_error(), E_USER_ERROR); } ?></strong></pre><div><br>Seharusnya DB_SERVER , DB_USER , DB_PASSWORD, DB_DATABASE.<br>Itu Di Ganti Dengan Username , Password & Nama Database Nya.<br><br>Contoh : </div><pre><strong><?php require_once DIR . '/db_config.php'; $conn = new mysqli(localhost, root, (password mysql agan), (nama database yang di buat)); if (mysqli_connect_errno()) { trigger_error('Koneksi ke database gagal: ' . mysqli_connect_error(), E_USER_ERROR); } ?></strong></pre>
<pre><?php require_once DIR . '/db_config.php'; $conn = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_DATABASE); if (mysqli_connect_errno()) { trigger_error('Koneksi ke database gagal: ' . mysqli_connect_error(), E_USER_ERROR); } ?></pre>