I have the following code in my codeigniter's view file.
<?php foreach ($records as $rows){?>
<? echo $rows['product_name']; ?> <br>
<? } ?>
my model
$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;
If I run the above code I get the following result
Pepsi
Coke
Mountain Dew
I am trying to show only the first result (Pepsi). Could you please show me how to do that?