-2
-
public function show() { $query = $this->db->get('text'); return $query->result(); }
2.Controller
public function inf()
{
$this->load->model('addm');
$data['results'] = $this->addm->show($query);
$this->load->view('backend/first',$data);
}
3.view
我想從我的分貝,但我得到的數據無法解決此錯誤: 未定義的變量:結果
<?php
echo"<td>";
if (is_array($result)) {
foreach ($result() as $row) {
$id = $row->id;
$words = $row->words;
}
}
echo "</td>";
?>
模型公共職能秀() \t { \t \t \t \t $查詢= $這個 - > DB-> GET( '文'); \t \t return $ query-> result(); \t \t}控制器公共函數INF() \t \t { \t \t \t $這 - >負載>模型( 'ADDM'); \t \t \t $ data ['results'] = $ this-> addm-> show(); \t \t \t \t \t \t $這 - >負載>視圖( '後端/第一',$數據); \t \t} model <?php echo「」; ($ results)){ foreach($ results as $ row){ $ id = $ row-> id; $ words = $ row-> words; } } echo「」; ? > //我仍然有這個錯誤 – zeko50
@ zeko50請告訴我你的錯誤檢查getting..and上面的代碼 – jlocker
一個PHP錯誤遇到 嚴重性:注意 消息:未定義的變量:結果 文件名:後端/ first.php 行號:74 – zeko50