Rabu, 09 Oktober 2013

PHP Indonesia - Facebook: [Tanya | PHP JS] Saya punya script di bawah ini :...

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/ 
Learn Adobe Illustrator CS6 Master Techniques from an Adobe Guru!

With over 25 years of experience teaching, Robert Farrell has been a trusted instructor for individuals and companies who want to improve their Adobe skills.
From our sponsors
[Tanya | PHP JS] Saya punya script di bawah ini :...
Oct 9th 2013, 10:52, by Idle Track

Idle Track 10:52am Oct 9
[Tanya | PHP JS]

Saya punya script di bawah ini :

//-------------------------------------------------------------------------
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");

/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}

if (!mysqli_query($link, "SET a=1")) {
printf("Errormessage: %s\n", mysqli_error($link));
}

/* close connection */
mysqli_close($link);
?>
//-------------------------------------------------------------------------

Pertanyaannya :
Bagaimana menyisipkan javascript alert pada script tersebut diatas, yang digunakan untuk memberikan pesan errornya.

Indra Aria Pramana 11:24am Oct 9
<script>alert('Koneksi gagal!'); history.back(); </script>

Idle Track 11:25am Oct 9
Indra Aria Pramana : Oke mas, kalau seperti itu sudah saya coba dan bisa, tapi bagaimana kalau mau menangkap errornya langsung yang diberikan oleh PHP-nya, ???

Indra Aria Pramana 11:27am Oct 9
"menangkap errornya" maksudnya?
buat nunjukin kesalahan script di line berapa gitu?

Idle Track 11:43am Oct 9
Iya mas,, mau menampilkan pesan error yang ini ---> printf("Connect failed: %s\n", mysqli_connect_error());

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