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.

READ :  PHP classes constructor and destructor Example

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.

codeigniter get single row

php codeigniter Example
[php]
$products_data = $this->db->get(“products”)->row();

print_r($products_data);
[/php]

Test Output:
[php]
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
)
[/php]

We can also get single data fields value from object:

[php]
$products_data = $this->db->get(“products”)->row();
print_r($products_data->title);
[/php]

Web Programming Tutorials Example with Demo

Read :

READ :  PHP Toggle switch Update DB field using jQuery Ajax

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.

Leave a Comment