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,

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

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法