codeigniterのビューファイルに次のコードがあります。
<?php foreach ($records as $rows){?>
<? echo $rows['product_name']; ?> <br>
<? } ?>
私のモデル
$this->db->select('*');
$this->db->from('products');
$this->db->order_by('product_name','ASC');
$getData = $this->db->get('');
if($getData->num_rows() > 0)
return $getData->result_array();
else
return null;
上記のコードを実行すると、次の結果が得られます
Pepsi
Coke
Mountain Dew
最初の結果(ペプシ)のみを表示しようとしています。その方法を教えていただけませんか。