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

How to get single row data in CI

Result Rows

Row() returns a single result row data.  If Query has more than one row, it returns only the first row of data. The result is returned as an object. Example:-

$query = $this->db->query(“YOUR QUERY”);

$row = $query->row();

if (isset($row))
{
echo $row->title;
echo $row->name;
}
If you want data in array format use row_array()
Example:

$query = $this->db->query(“YOUR QUERY”);

$row = $query->row_array();

if (isset($row))
{
echo $row[‘title’];
echo $row[‘name’];
echo $row[‘body’];
}

Generating Query Results as Row in CI

The post How to get single row data in CI appeared first on PHPCORELAB.



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

Share the post

How to get single row data in CI

×

Subscribe to Quick Reference For Php

Get updates delivered right to your inbox!

Thank you for your subscription

×