codeigniterにコントローラからビューに自分のユーザーデータを渡そうとしていますが、データが渡されず、エラーメッセージがポップアップ表示されていません。 。あなたがメンバーにアクセスするための矢印演算子を使用している代わりにresult_array()
.Becauseのresult()
をformatusingオブジェクト内のcontroller.FEtchレコードでコントローラからビューに配列データが渡されない
コントローラ
public function customerRecive($cust_ID)
{
$ID_decript = base64_decode($cust_ID);
$this->db->where('CustomerID', $ID_decript);
$query=$this->db->get('gst_customermaster');
$cust_details= $query->result_array();
$data['cust_details'] = $cust_details;
//print_r($cust_details);
//load the department_view
$this->load->view('category_link_details_view',$data);
}
ビュー
<table class='table table-bordered'>
<thead>
<tr>
<th> # </th>
<th> CustomerCode</th>
<th> CustomerName</th>
<th> ContactPerson</th>
<!--<th> Edit</th>-->
<th> Delete</th>
</thead>
<tbody>
<?php for ($i = 0; $i < count($cust_details); ++$i) { ?>
<tr>
<td><?php echo ($i+1); ?></td>
<td><?php echo $cust_details[$i]->CustomerCode; ?></td>
<td><?php echo $cust_details[$i]->CustomerName; ?></td>
<td><?php echo $cust_details[$i]->ContactPerson; ?></td>
<!-- <td><a href="#" onClick="show_confirm('edit',<?php $cust_details[$i]->id;?>)">Edit</a></td> -->
<!-- <td><a href="<?php echo base_url();?>index.php/<?php $cust_details[$i]->id;?>">Edit</a></td> -->
<!--<td><?php echo anchor('Category_retrieve/edit_data/'.$cust_details[$i]->id, ' Edit');?></td> -->
<td><?php echo anchor('Category_retrieve/delete_data/'.$cust_details[$i]->id, ' Delete');?></td>
</tr>
<?php } ?>
</tbody>
</table>
マインドMVCの使用MVCフレームワークを使用するための
。コントローラ内ではなくモデル内でクエリを実行します。また、<?php echo($ i + 1)?>を= $i++ ?>に変更することもできます。 – killstreet
ありがとうございました... !! –