koneksi.php
<?php
$server = "localhost";
$username = " ";
$password = " ";
$database = "mahasiswa";
//contoh 1
//koneksi dan memilih database di server
//mysql_connect($server,$username,$password);
//mysql_select_db ($database);
//contoh 2
//mysql_connect($server,$username,$password) or die ("koneksi gagal");
//mysql_select_db ($database)or die ("database tidak bisa dibuka");
//contoh 3
$connect = mysql_connect($server,$username,$password);
if ($connect){
echo " koneksi berhasil ";
$pilihdb= mysql_select_db ($database);
if ($pilihdb) {
echo " database ".$database." telah di temukan ";}
else{
echo " database ".$database." tidak di temukan ";}
}
else {
echo "koneksi gagal "; }
?>
<?php
$server = "localhost";
$username = " ";
$password = " ";
$database = "mahasiswa";
//contoh 1
//koneksi dan memilih database di server
//mysql_connect($server,$username,$password);
//mysql_select_db ($database);
//contoh 2
//mysql_connect($server,$username,$password) or die ("koneksi gagal");
//mysql_select_db ($database)or die ("database tidak bisa dibuka");
//contoh 3
$connect = mysql_connect($server,$username,$password);
if ($connect){
echo " koneksi berhasil ";
$pilihdb= mysql_select_db ($database);
if ($pilihdb) {
echo " database ".$database." telah di temukan ";}
else{
echo " database ".$database." tidak di temukan ";}
}
else {
echo "koneksi gagal "; }
?>
0 komentar:
Posting Komentar