Guest User

Untitled

a guest
Jan 11th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. <?php
  2. // Declarations
  3. $hostname = "localhost";
  4. $username = "dbuser";
  5. $password = "unknown";
  6. $db = "myDB";
  7.  
  8. // Database connection using MYSQLi
  9. $conn = new mysqli($hostname, $username, $password, $db);
  10. mysqli_query($conn,"SELECT * FROM table");
  11.  
  12. // Database connection using PDO with MySQL Driver
  13. $conn = new PDO("mysql:host=$hostname;dbname=db", $username, $password);
  14. $conn->query("SELECT * FROM table");
  15. ?>
Add Comment
Please, Sign In to add comment