Guest User

Untitled

a guest
Oct 19th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. $dsn = getenv('MYSQL_DSN');
  2. $user = getenv('MYSQL_USER');
  3. $password = getenv('MYSQL_PASSWORD');
  4. try {
  5. $db = new PDO($dsn, $user, $password);
  6. $statement = $db->prepare("SELECT * from user");
  7. $statement->execute();
  8. $users = $statement->fetchAll();
  9. } catch (Exception $e) {
  10. echo 'Caught exception: ', $e->getMessage(), "n";
  11. }
  12.  
  13. runtime: php
  14. env: flex
  15.  
  16. runtime_config:
  17. document_root: .
  18.  
  19. env_variables:
  20. MYSQL_DSN: mysql:dbname=DATABASE;unix_socket=/cloudsql/CONNECTION_NAME
  21. MYSQL_USER: username
  22. MYSQL_PASSWORD: password
Add Comment
Please, Sign In to add comment