Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- try {
- require_once 'conf.php';
- $conn = mysqlConnector();
- $stmt = $conn->prepare('SELECT * FROM demo');
- $stmt->execute();
- while($row = $stmt->fetch()) {
- print_r($row);
- }
- } catch(PDOException $e) {
- echo 'ERROR: ' . $e->getMessage();
- }
- ?>
- <?php
- define('DB_HOST', getenv('127.*.**.*'));
- define('DB_PORT',getenv('****'));
- define('DB_USER',getenv('admin4*****'));
- define('DB_PASS',getenv('databasePassword'));
- define('DB_NAME',getenv('ssh://5348030a***************@landbayscaling-innovifytest.rhcloud.com/~/git/landbayscaling.git/'));
- function mysqlConnector(){
- $dsn = 'mysql:dbname='.DB_BASE.';host='.DB_HOST.';port='.DB_PORT;
- $dbh = new PDO($dsn, DB_USER, DB_PASS);
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return $dbh;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement