要转发的第一个视图页面
<div class="row">
<div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
<select name="forwardto[]" class="form-control">
<option value="">Select</option>
<?php foreach($userlist as $row):?>
<option value="<?php echo $row['cid']?>">
<?php echo $row['FirstName'].$row['MiddleName'].$row['LastName']?>
</option>
<?php endforeach;?>
</select>
</div>
内部控制器
function forward($param1='', $param2=''){
$data1['message']='';
$data['ForwarderId']=$this->session->userdata('cid');
$data['ForwarderName']=$this->session->userdata('name');
$data['Designation']=$this->session->userdata('position'); /* title ..I have created Designation in Stmessage table */
$data1['RecieverId']=implode(', ', $_POST['forwardto']);
$Rcid = implode(" ", $data1);
$data['RecieverName']=$this->ag->name($Rcid);//this is not working
//ag->is agency model
$this->db->update('st_message', $data);
if($this->db->affected_rows()>0){
$dat['ReadStatus']='N';
$this->db->where('Id', $param1);
$this->db->update('st_message', $dat);
内部模型
public function name($Rcid)
{
$query=$this->db->query("SELECT CONCAT(e.FirstName, ' ',e.MiddleName, ' ', e. Lastname) as name, e.cid AS cid FROM bpas_user_profiles e
WHERE e.cid='".$Rcid."'");
if ($query->num_rows() > 0)
{
return $query->row();
} else {
return array();
}
}
实际上,选择了一个示例11112334的数据,并将其通过forwardto []传递给控制器。 但是,当我将与forwardto []相关的$ Rcid作为参数传递给模型时,它无法获取。实际上,我想将数字示例111323232映射为表中的名称并对其进行更新