putradnata

Connect to Database from PHP using Mysqli

Jun 8th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.30 KB | None | 0 0
  1. <?php
  2.  
  3.     //Koneksi
  4.     $con=mysqli_connect("localhost","root","password"); // your sql setting, if there's no password, dont type it, keep it blank
  5.     $select = mysqli_select_db($con,"your_database");
  6.     //Check connection
  7.     if(!select)
  8.         {
  9.             echo "Failed to Connect to SQL: ".mysqli_connect_error();
  10.         }
  11.  
  12. ?>
Advertisement
Add Comment
Please, Sign In to add comment