Fetch Single Row From Database in Codeigniter

Today, We want to share with you Fetch Single Row From Database in Codeigniter.In this post we will show you how to fetch data by id from database in php, hear for how to get multiple rows from database in codeigniter we will give you demo and example for implement.In this post, we will learn about How to fetch single row from database in php codeigniter? with an example.

Fetch Single Row From Database in Codeigniter

There are the Following The simple About Fetch Single Row From Database in Codeigniter Full Information With Example and source code.

As I will cover this Post with live Working example to develop fetch single data in codeigniter, so the how to get num row in codeigniter for this example is following below.

READ :  Search Comma Separated values using Laravel Query FIND_IN_SET

codeigniter get single row

php codeigniter Example

$products_data = $this->db->get("products")->row();

print_r($products_data);

Test Output:

stdClass Object
(
    [id] => 2
    [title] => PHP codeigniter database Example 
    [description] => how to get multiple rows from database in codeigniter : pakainfo.com
    [created_at] => 0000-00-00 00:00:00
    [updated_at] => 0000-00-00 00:00:00
)

We can also get single data fields value from object:

$products_data = $this->db->get("products")->row();
print_r($products_data->title);

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Fetch Single Row From Database in Codeigniter.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

READ :  AngularJS Searching Sorting Pagination with DataTable using PHP And MySQL
https://pakainfo.com/

Add a Comment

Your email address will not be published. Required fields are marked *