Jumat, 02 Agustus 2013

PHP Indonesia - Facebook: mau tanya nih. function set_server($hostname, $u...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
mau tanya nih. function set_server($hostname, $u...
Aug 2nd 2013, 17:27, by Iyan Anwar Fauzi

Iyan Anwar Fauzi 5:27pm Aug 2
mau tanya nih.

function set_server($hostname, $username, $password) {
$koneksi = mysql_connect($hostname, $username, $password);
if (!$koneksi) {
echo "Cek kembali koneksi ke server";
}
}

function set_db($db) {
$select_db = mysql_select_db($db);
if (!$select_db) {
echo "Cek kembali koneksi ke database";
}
}

set_server("localhost", "root", "");
set_db("coba");

kalo mau di bikin class gimana yah??

Fikri Handa Herriansyah 5:28pm Aug 2
tinggal class koneksi :3

Iyan Anwar Fauzi 5:33pm Aug 2
seperti ini kah??

class koneksi {
function set_server($hostname, $username, $password) {
$koneksi = mysql_connect($hostname, $username, $password);
if (!$koneksi) {
echo "Cek kembali koneksi ke server";
}
}

function set_db($db) {
$select_db = mysql_select_db($db);
if (!$select_db) {
echo "Cek kembali koneksi ke database";
}
}

set_server("localhost", "root", "");
set_db("coba");
}

terus, cara panggil di file yg lain gmna?
punten newbe. :D

Moch Mufiddin 5:35pm Aug 2
class nama_kelas{

function set_server($hostname, $username, $password) {
$koneksi = mysql_connect($hostname, $username, $password);
if (!$koneksi) {
echo "Cek kembali koneksi ke server";
}
}

function set_db($db) {
$select_db = mysql_select_db($db);
if (!$select_db) {
echo "Cek kembali koneksi ke database";
}
}

}

//panggil fungsinya
$objek = new nama_kelas();
$objek->set_server("localhost", "root", "");
$objek->set_db("coba");

Fikri Handa Herriansyah 5:36pm Aug 2
coba baca ini http://www.php.net/manual/en/mysqli.construct.php Object oriented style when extending mysqli class itu ..

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar