我有这个型号:
public function getmstasset($id)
{
//$this->load->model('sitemodel');
//$data['content']=$this->sitemodel->listpelanggan()->result_array();
$this->db1 = $this->load->database('default', true);
return $this->db1->select('assetview.*')
->from('assetview')
->where('idasset',$id)
->get();
//$this->load->view('template', $data, FALSE);
}
控制器:
public function addfromasset($id)
{
$this->load->model('assetmodeltrn');
$data['getasset'] = $this->assetmodeltrn->getmstasset($id)->result_array();
$data['content'] = 'transaksi/assetdist_trn';
$this->load->view('template', $data);
}
观点:
MAC地址 * MAC_ADDR; ?&gt;“name =”macaddr“readonly =”readonly“required =”required“type =”text“&gt; <div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="serialnum">Serial Number<span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="serialnum" class="form-control col-md-7 col-xs-12" name="serialnum" value="<? echo $getasset->serialnumber ?>" readonly="readonly" placeholder="Serial Number" required="required" type="text"></input>
</div>
</div>
返回错误:
遇到PHP错误
严重性:注意
消息:尝试获取非对象的属性
文件名:transaksi / assetdist_trn.php
行号:26
请帮助
最诚挚的问候,
典
答案 0 :(得分:0)
我解决了问题,我改变了控制器:
$ data ['getasset'] = $ this-&gt; assetmodeltrn-&gt; getmstasset($ id) - &gt; result_array();
到
$ data ['getasset'] = $ this-&gt; assetmodeltrn-&gt; getmstasset($ id) - &gt; row();
由于
丶