dongshen5115 2017-06-19 15:04
浏览 44
已采纳

Android应用程序的PHP MYSQL错误

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!');
        }

    }
  • 写回答

1条回答 默认 最新

  • duanfanta6741 2017-07-08 18:52
    关注

    SOLVED:

    REPLACE(n.channel_url, '?wmsAuthSign=', '?wmsAuthSign=".$base64urlsignature."') as channel_url,
    

    UNDER n.channel_image,

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题