Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $dsn = getenv('MYSQL_DSN');
- $user = getenv('MYSQL_USER');
- $password = getenv('MYSQL_PASSWORD');
- try {
- $db = new PDO($dsn, $user, $password);
- $statement = $db->prepare("SELECT * from user");
- $statement->execute();
- $users = $statement->fetchAll();
- } catch (Exception $e) {
- echo 'Caught exception: ', $e->getMessage(), "n";
- }
- runtime: php
- env: flex
- runtime_config:
- document_root: .
- env_variables:
- MYSQL_DSN: mysql:dbname=DATABASE;unix_socket=/cloudsql/CONNECTION_NAME
- MYSQL_USER: username
- MYSQL_PASSWORD: password
Add Comment
Please, Sign In to add comment