Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'config.php';
- $sql = "select * from epg e where e.channel_code='APL' order by e.id ASC";
- try {
- $dbh = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbuser, $dbpass);
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $stmt = $dbh->query($sql);
- $SistemPakar= $stmt->fetchAll(PDO::FETCH_OBJ);
- $dbh = null;
- $json = json_encode($SistemPakar);
- // Using JSONP
- if ($_GET['callback']) {
- echo $_GET['callback'] . "($json);"; // somefunction({data here});
- // Normal JSON
- } else {
- //echo $json;
- echo '{"items":'. json_encode($SistemPakar) .'}';
- }
- //echo '{"items":'. json_encode($SistemPakar) .'}';
- } catch(PDOException $e) {
- echo '{"error":{"text":'. $e->getMessage() .'}}';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement