dpn517111 2017-04-09 14:57
浏览 17

api中的条件返回数据库错误

I'm trying to edit in api service which i want to make it didn't show the last news when the message staute is blocked , and only showing them when the news message is active so here's the function doing that but I'm getting an error ( Database error )

    public function getlatest($select_values = "*", $table_name, $join_on = "", $language_id) {
    $join_table = "language_" . $table_name;
    $result = array();
    $this->db->select($select_values);
    $this->db->from($table_name);
    if ($table_name != "latestnews") {
        $this->db->where($table_name . ".featuredstatus", "Yes");

    }
    $this->db->join($join_table, $table_name . "." . $join_on . "=" . $join_table . "." . $join_on, "left");
    $this->db->where($join_table . ".languageid", $language_id);
     $this->db->where($table_name . ".latestnewsstatus", "Active");
   $this->db->limit("2");
    $result = $this->db->get()->result_array();
    return $result;
}

It was working fine without that line :

     $this->db->where($table_name . ".latestnewsstatus", "Active");

Which i have added It to showing only the messages with active statue . so why I'm getting this error ?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大