Advertisement
Guest User

koneksi

a guest
Oct 30th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2. function koneksi_db(){
  3.  
  4. $host = "localhost";
  5.  
  6. $database = "comepost";//sesuaikan nama db kamu
  7.  
  8. $user = "root";//sesuaikan usernya, kalau di cpanel usernya ganti juga, biasanya nama user akun cpanel
  9.  
  10. $password="";// sesuaikan password kamu, kalau di cpanel ganti juga, biasanya password akun cpanel
  11.  
  12. $link = mysql_connect($host,$user,$password);//koneksi ke db
  13.  
  14. mysql_select_db($database,$link);//pilih nama db
  15.  
  16. if(!$link)
  17.  
  18. echo "Error : ".mysql_error();
  19.  
  20. return $link;
  21. }
  22. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement