Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
PHP Pemula - mysqli_query(): Argument #1 ($mysql) must be of type mysqli, null given
<?php
// Koneksi ke database
$conn = mysqli_connect("localhost", "root", "", "bedas");
// Function
function query($query)
{
global $conn;
$result = mysqli_query($conn, $query);
$rows = [];
while ($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
}
return $rows;
}
qqq.PNGwww.PNG
0
1 Jawaban:
Jawaban Terpilih
<pre><?php function koneksi() { $conn = mysqli_connect("localhost", "root", "", "bedas");
return $conn ;
} function query($query) { $conn=koneksi(); $result = mysqli_query($conn, $query);</pre>
1