0
我試圖使用WHERE子句作爲變量在頁面(VIEW)中顯示一些數據來自數據庫。但未能獲得預期的數據。如何在參數爲空時從數據庫獲取所有數據
$this->db->select('vehicle.*,vec_source.vec_Source,vec_images.image1');
$this->db->from('vehicle');
$this->db->join('vec_images', 'vehicle.vec_Id = vec_images.vec_Id_fk','inner');
$this->db->join('vec_source', 'vehicle.vec_Id = vec_source.vec_Id_fk','inner');
$this->db->where_in('Make',$make);
$query = $this->db->get();
return $query->result_array();
上述查詢工作正常,但是當變量$使是空的,那麼如何顯示完整的結果其中類似=「%」如何實現這一IN子句
在此先感謝
感謝@u_mulder,但告訴我如何從數據庫中獲得完整的結果,如** like子句**執行'LIKE('%')',但如何使用** IN CLAUSE **實現此目的? –
我不明白,用'IN'預期的查詢是什麼? –