What am I doing wrong?
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?wmsAuthSign=, n.channel_description, c.c' at line 6302
private function get_posts() {
include "../includes/config.php";
$setting_qry = "SELECT * FROM tbl_fcm_api_key where id = '1'";
$setting_result = mysqli_query($connect, $setting_qry);
$settings_row = mysqli_fetch_assoc($setting_result);
$api_key = $settings_row['api_key'];
if (isset($_GET['api_key'])) {
$access_key_received = $_GET['api_key'];
if ($access_key_received == $api_key) {
if($this->get_request_method() != "GET") $this->response('',406);
$limit = isset($this->_request['count']) ? ((int)$this->_request['count']) : 10;
$page = isset($this->_request['page']) ? ((int)$this->_request['page']) : 1;
$offset = ($page * $limit) - $limit;
$count_total = $this->get_count_result("SELECT COUNT(DISTINCT n.id) FROM tbl_channel n");
$query = "SELECT distinct
n.id AS 'channel_id',
n.category_id,
n.channel_name,
n.channel_image,
n.channel_url?wmsAuthSign=<?php echo $base64urlsignature;?>,
n.channel_description,
c.category_name
FROM
tbl_channel n,
tbl_category c
WHERE
n.category_id = c.cid ORDER BY n.id DESC LIMIT $limit OFFSET $offset";
$post = $this->get_list_result($query);
$count = count($post);
$respon = array(
'status' => 'ok', 'count' => $count, 'count_total' => $count_total, 'pages' => $page, 'posts' => $post
);
$this->response($this->json($respon), 200);
} else {
die ('Oops, API Key is Incorrect!');
}
} else {
die ('Forbidden, API Key is Required!');
}
}