Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

What is difference between result and result_array in CI

if we use result()  to get results it will returns  the Query result as an array of objects
$query = $this->db->query(“YOUR QUERY”);

foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->body;
}

if we use result_array()  to get result as a pure array
$query = $this->db->query(“YOUR QUERY”);

foreach ($query->result_array() as $row)
{
echo $row[‘title’];
echo $row[‘name’];
echo $row[‘body’];
}

 
Generating Query Results in CI

The post What is difference between result and result_array in CI appeared first on PHPCORELAB.



This post first appeared on Quick Reference For PHP, please read the originial post: here

Share the post

What is difference between result and result_array in CI

×

Subscribe to Quick Reference For Php

Get updates delivered right to your inbox!

Thank you for your subscription

×