Следуйте за ошибкой, которую я получаю, когда пытаюсь выполнить strtolower() мой проверил в codeigniter. это ошибка:ошибка strtolower функция в codeigniter
strtolower() expects parameter 1 to be string, object given
и
Undefined property: CI_Loader::$unit_id
это мой взгляд
<div class="checkbox">
<?php foreach ($unit_list as $unit) :?>
<?php $isChecked = (strtolower($unit->unit_id) == strtolower($unit_id)) ? true : false; ?>
<label>
<input type="checkbox" checked='$isChecked' name="unit_id[]" value="<?php echo $unit->unit_id ?>"><?php echo $unit->unit_id ?>
</label>""
<?php endforeach?>
</div>
этот контроллер
$this->data['unit_list']= $this->munit_list->get_all_unit_list2();
$fleet = $this->input->post('id_fleet');
$unit_id = $this->input->post('unit_id');
$this->data['unit_id']= $unit_id;
// get shift and date
$q = $this->database_three->select("*")->from('fleet')->where('id_fleet', $fleet)->limit(1)->get()->row();
$fleet_date = $q->date;
$fleet_shift = $q->shift;
//$this->db->select('f.*, fm.*')->from('fleet_member as fm, fleet as f');
$custom_sql = "fm.id_fleet = f.id_fleet AND f.date = '$fleet_date' AND f.shift = '$fleet_shift'";
$custom_where = "";
$records = array();
for ($i=0; $i < count($unit_id) ; $i++) {
$records[] = array(
'id_fleet' => $fleet,
'unit_id' => $unit_id[$i]
);
модель
function get_all_unit_list2()
{
$this->database_two->order_by('unit_id','desc');
$data = $this->database_two->query(
"Select unit_list.unit_id, vehicle_group.vec_type, vehicle_group.vec_group
from unit_list, vehicle_group
where unit_list.vec_type = vehicle_group.vec_type
AND vec_group IN ('OHT','ADT') ");
return $data->result();
}
Вы можете помочь мне решить эту проблему?
Какая функция get_all_unit_list2 возвращает строку или объект? – vijaykumar
'$ this-> unit_id' не является чем-либо, что будет передано вашему контроллеру. Задайте идентификатор устройства в своем контроллере, выполнив '$ this-> data ['unit_id'] = $ unit_id;' вместо '$ this-> unit_id = $ unit_id;' и назвав его в вашем представлении следующим образом: ' $ isChecked = (strtolower ($ unit-> unit_id) == strtolower ($ unit_id))? true: false; ' – RhapX
@ vijay4vijju array (46) {[0] => object (stdClass) # 26 – point