lundi 22 décembre 2014

error strtolower function in codeigniter

The follow error I get when I try to strtolower() my checked in codeigniter. this is error:



strtolower() expects parameter 1 to be string, object given


and



Undefined property: CI_Loader::$unit_id


this is my view



<div class="checkbox">
<?php foreach ($unit_list as $unit) :?>
<?php $isChecked = strtolower($unit) == strtolower($this->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 controller



$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->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]
);


can you help me how to solve this problem?





Aucun commentaire:

Enregistrer un commentaire