Codeigniter活动查询错误

时间:2015-07-08 06:25:40

标签: codeigniter

这是我的查询

/**
 * Get the post register / login redirect path.
 *
 * @return string
 */
public function redirectPath()
{
    if (property_exists($this, 'redirectPath'))
    {
        return $this->redirectPath;
    }

    return property_exists($this, 'redirectTo') ? $this->redirectTo : '/';
}

在浏览器中检查其生成此查询

$this->db->select('amount AS SavingAmount');
    $query  = $this->db->get_where('cashman_trial_balance',array('category_id'=>'176','clientId'=>$user['UserID'],'year'=>$year));

我不知道这两颗星来自哪里?

控制器代码

SELECT *, *, `amount` AS SavingAmount FROM (`cashman_trial_balance`) WHERE `category_id` = '176' AND `clientId` = '122' AND `year` = '2015/2016'

型号代码

$som_var = $this->client->statistics(); 

2 个答案:

答案 0 :(得分:0)

使用此

      $query = $this->db->query("SELECT amount AS SavingAmount FROM table_name WHERE category_id = '176' 
      AND clientId = '$user['UserID']' AND 'year'= '$year') ");
      $result = $query->result_array();
      return $result;

答案 1 :(得分:0)

您可以使用简单的方法

$query = $this->db->query("SELECT amount AS SavingAmount FROM cashman_trial_balance WHERE category_id = '176' AND clientId=$user['UserID'] AND year=$year");