Warning: mysqli_select_db() expects exactly 2 parameters, 1 given on line 23 no database

<?php

$db_host = "localhost";

$db_username = "root";

$db_pass = "";

$db_name = "dbsurat";

function formatBytes($bytes, $precision = 2) {

    $units = array('B', 'KB', 'MB', 'GB', 'TB');

    $bytes = max($bytes, 0);

    $pow = floor(($bytes ? log($bytes) : 0) / log(1024));

    $pow = min($pow, count($units) - 1);

    $bytes /= pow(1024, $pow);

    return round($bytes, $precision) . ' ' . $units[$pow];

}

mysqli_connect("$db_host","$db_username","$db_pass") or die ("could not connect to mysql");

mysqli_select_db("$db_name") or die ("no database");

?>

mohon bantuannya, terima kasih

avatar nuratika_google
@nuratika_google

1 Kontribusi 0 Poin

Diperbarui 3 tahun yang lalu

1 Jawaban:

<div>Pertanyaan error ini sudah pernah ditanyakan di:<br><a href="https://sekolahkoding.com/forum/warning-mysqli-select-db-expects-exactly-2-parameters">https://sekolahkoding.com/forum/warning-mysqli-select-db-expects-exactly-2-parameters</a><br><a href="https://sekolahkoding.com/forum/mysqli-select-db-expects-exactly-2-parameters">https://sekolahkoding.com/forum/mysqli-select-db-expects-exactly-2-parameters</a><br><a href="https://sekolahkoding.com/forum/cara-mengatasi-warning-mysqli-select-db-expects-exactly-2-parameters">https://sekolahkoding.com/forum/cara-mengatasi-warning-mysqli-select-db-expects-exactly-2-parameters</a></div>

avatar hilmanski
@hilmanski

2686 Kontribusi 2135 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban