Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('dblog.php');
- //Open PDO Connection
- $dbconfig = array(
- 'user' => $username,
- 'pass' => $password,
- 'host' => 'localhost',
- 'name' => $dbname,
- );
- //connect
- $conn = new PDO("mysql:host=$dbconfig[host];dbname=$dbconfig[name]", $dbconfig[user], $dbconfig[pass]);
- $conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
- $query = "SELECT * FROM Events;";
- $result = $conn->prepare($query);
- //$result->bindParam(":userId", $userId); - Use this to bind param in future!
- $result->execute();
- $r = $result->fetchAll();
- echo json_encode($r, JSON_UNESCAPED_UNICODE);
- ?>
- <?php
- // Connects to Our Database
- $server = "localhost";
- $username = "yourUsername";
- $password = "yourPassword";
- $dbname = "dbNAME";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement