Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- $callback jQuery1123009962440195479316_1526746247448
- $format json
- $inlinecount allpages
- $skip 20
- $top 20
- */
- $mysqli = @new mysqli('localhost', 'root3', '', 'fb_demo');
- // Works as of PHP 5.2.9 and 5.3.0.
- if ($mysqli->connect_error) {
- die('Connect Error: ' . $mysqli->connect_error);
- }
- $limit = isset($_GET['$top']) ? $_GET['$top'] : 10;
- $start = isset($_GET['$skip']) ? $_GET['$skip'] : 0;
- $callback = $_GET['$callback'];
- $data = array();
- $sql = "select * from my_orders limit $start,$limit";
- $que = $mysqli->query($sql);
- if ($que) {
- while ($row = $que->fetch_array(MYSQLI_ASSOC)) {
- $data[] = $row;
- }
- } else {
- die($mysqli->error);
- }
- $sql = "select count(*) c from my_orders ";
- $que = $mysqli->query($sql);
- if ($que) {
- $row = $que->fetch_array(MYSQLI_ASSOC);
- $total = $row['c'];
- } else {
- die($mysqli->error);
- }
- $result = array(
- 'results' => $data,
- '__count' => $total
- );
- $respon = array('d' => $result, 'params' => $_GET);
- $json = json_encode($respon);
- echo "$callback(\n$json\n)";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement