Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = 'username';
- $passowrd = 'password';
- $conn = new PDO('mysql:host=ip;dbname=DBName;port=3306',$user,$passowrd);
- ?>
- <?php
- include 'DB.php';
- class Manager {
- function jsonQuery() {
- $response = array ();
- $st = $conn->query ( "query");
- $response ["results"] = array ();
- foreach ( $st->fetchAll () as $row ) {
- //my stuff with the query
- }
- $response ["success"] = 1;
- echo json_encode ( $response );
- }
- }
- $object = new Manager();
- $object->jsonQuery();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement