Knowledgebase:MySQLi
Fungsi mysqli_select_db()
Posted by Ari Sigit on 10 June 2019 01:14 pm
Definisi dan Penggunaan
Fungsi mysqli_select_db () digunakan untuk mengubah database default untuk koneksi.
Contoh Script:
<?php
$con=mysqli_connect("localhost","my_user","my_password","my_db");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// ...some PHP code for database "my_db"...
// Change database to "test"
mysqli_select_db($con,"test");
// ...some PHP code for database "test"...
mysqli_close($con);
?>