Guest User

Untitled

a guest
Aug 18th, 2018
693
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. $host = "localhost";
  2. $db = "mydb";
  3. $user = "user";
  4. $pass = "qRES2fIWK8Gg";
  5.  
  6. try
  7. {
  8. $db = new PDO("mysql:host = $host; dbname = $db", $user, $pass);
  9. $db -> exec ("SET NAMES utf8"); // charset = utf8 doesn't work.
  10. echo "Database connection is successful. <br>";
  11. }
  12.  
  13. catch (PDOException $e)
  14. {
  15. echo $e -> getMessage();
  16. }
  17.  
  18. SELECT * FROM settings WHERE settings_id= :id
  19.  
  20. SELECT * FROM mydb.settings WHERE settings_id= :id
  21.  
  22. "mysql:host=$host;dbname=$db"
Add Comment
Please, Sign In to add comment