亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為代碼“DateTime::createFromFormat”的 foreach ()

為代碼“DateTime::createFromFormat”的 foreach ()

PHP
慕姐8265434 2021-11-05 18:40:44
我在 codeigniter 中設置它,以便時間戳在數據庫中的格式為 (yyyy-mm-dd hh: ii: ss) 到 (yyyy-mm-dd)    function login($patient_ext_id,$birth_dttm) {            $this->db->select('xocp_ehr_patient.patient_ext_id, xocp_persons.person_nm, xocp_persons.birthplace, xocp_persons.birth_dttm, xocp_persons.status_cd, xocp_persons.race_nm');            $this->db->from('xocp_ehr_patient');            $this->db->join('xocp_persons', 'xocp_ehr_patient.person_id = xocp_persons.person_id');            /*$this->db->join("xocp_persons","xocp_persons.person_id = xocp_ehr_patient.patient_ext_id","left");*/            $this->db->where('xocp_ehr_patient.patient_ext_id', $patient_ext_id);            $tgl = $this->db->select(DateTime::createFromFormat('Y-m-d','xocp_persons.birth_dttm'));            $this->db->where($tgl, $birth_dttm);            /*$query =  $this->db->get('xocp_persons');*/            $query =  $this->db->get('');            return $query->num_rows();        }文件 database/DB_query_build.php 中的代碼無效public function select($select = '*', $escape = NULL)    {        if (is_string($select))        {            $select = explode(',', $select);        }        // If the escape value was not set, we will base it on the global setting        is_bool($escape) OR $escape = $this->_protect_identifiers;        foreach ($select as $val)        {            $val = trim($val);            if ($val !== '')            {                $this->qb_select[] = $val;                $this->qb_no_escape[] = $escape;                if ($this->qb_caching === TRUE)                {                    $this->qb_cache_select[] = $val;                    $this->qb_cache_exists[] = 'select';                    $this->qb_cache_no_escape[] = $escape;                }            }        }        return $this;    }嚴重性:警告消息:為 foreach() 提供的參數無效文件名:database/DB_query_builder.php行號:294
查看完整描述

2 回答

?
尚方寶劍之說

TA貢獻1788條經驗 獲得超4個贊

打印 $select。是否有獲取數據數組


    if(is_array($select)){

 foreach ($select as $val)

        {

     $val = trim($val);

      if ($val !== '')

        {

        $this->qb_select[] = $val;

        $this->qb_no_escape[] = $escape;

      if ($this->qb_caching === TRUE)

     {

        $this->qb_cache_select[] = $val;

        $this->qb_cache_exists[] = 'select';

        $this->qb_cache_no_escape[] = $escape;

            }

           }

          }

}


查看完整回答
反對 回復 2021-11-05
?
一只甜甜圈

TA貢獻1836條經驗 獲得超5個贊

您的查詢有誤。您可以將登錄功能替換如下。


function login($patient_ext_id,$birth_dttm) {

    $this->db->select('xocp_ehr_patient.patient_ext_id, xocp_persons.person_nm, xocp_persons.birthplace, xocp_persons.birth_dttm, xocp_persons.status_cd, xocp_persons.race_nm');

    $this->db->from('xocp_ehr_patient');

    $this->db->join('xocp_persons', 'xocp_ehr_patient.person_id = xocp_persons.person_id');

    /*$this->db->join("xocp_persons","xocp_persons.person_id = xocp_ehr_patient.patient_ext_id","left");*/

    $this->db->where('xocp_ehr_patient.patient_ext_id', $patient_ext_id);

    $this->db->having("DATE_FORMAT( xocp_persons.birth_dttm, '%Y-%m-%d') = '$birth_dttm'", "",false);

    /*$query =  $this->db->get('xocp_persons');*/

    $query =  $this->db->get('');

    return $query->num_rows();

}


查看完整回答
反對 回復 2021-11-05
  • 2 回答
  • 0 關注
  • 194 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號