Tag : Record



How to get last record from MySQL table in Codeigniter?

In this post we are going to learn how to get last single record from MySQl database table using Codeigniter database library. We sometime require to get only single row result in our Codeigniter application. In this post you can see how to get whole last record using Codeigniter db query. Few day ago i posted <a href="http://itsolutionstuff.com/post/how-to-get-last-inserted-id-in-codeigniterexample.html" target="_blank">"How to get last inserted id in Codeigniter?"</a>, in that post we can simply get last inserted id from Codeigniter db query. In this database query i used order_by(), limit.....

By Hardik Savani | March 9, 2017 | | 4413 Viewer | Category : MySql Codeigniter
READ MORE

How to get last inserted id in Codeigniter?

Sometimes, we require to get last insert record id from database in controller, so in this example we will learn how to get last inserted row id in Codeigniter 3 project. It's very often need to get last insert id in programming field, if you are working on Codeigniter framework and you want to fetch last created id, i mean max id, then you do easily.Codeigniter provide method insert_id() to get last inserted id. insert_id() is function of "db" library. db library provides several function for connecting database task. insert_id() will return id of last inserted record. So here i give contro.....

By Hardik Savani | February 28, 2017 | | 4490 Viewer | Category : MySql Codeigniter
READ MORE

How to get last record of database table in Laravel?

Sometimes we may require to get only last record of table in our project, we can get several way. We can fetch last record of database table using latest() or orderBy(). In bellow example you can see how i get then last record of table. I have "items" table and i want to get last record of "items" table. In first example i use latest() with first() because latest() will fetch only latest record according to created_at then first() will get only single record: <strong>Using latest() belong to created_at field:</strong> <pre class="prettyprint lang-php"> $last = DB::table('items')->latest()->f.....

By Hardik Savani | July 14, 2016 | | 20837 Viewer | Category : Laravel
READ MORE

How to insert multiple records in Laravel 5?

If we work on big project and then we maybe require to add multiple rows on database using laravel eloquent. Laravel provide insert method for bulk records create on db. In bellow example you can see i use multidimensional $myItems array variable and that insert multiple records same time using DB::insert(). So let's see and try this. <strong>Example:</strong> <pre class="prettyprint lang-php"> $myItems = [ ['title'=>'HD Topi','description'=>'It solution stuff'], ['title'=>'HD Topi 2','description'=>'It solution stuff 2'], ['title'=>'HD Topi 3','descriptio.....

By Hardik Savani | June 13, 2016 | | 15581 Viewer | Category : Laravel
READ MORE

    Laravel 5 - Dynamic Dependant Select Box using JQuery Ajax Example - Part 2

    Laravel 5 - Dynamic Dependant Select Box using JQuery Ajax Example - Part 2

    Open Post

    How to add ckeditor with image upload in Laravel ?

    How to add ckeditor with image upload in Laravel ?

    Open Post

    Laravel - How to search with comma separated values using Query Builder ?

    Laravel - How to search with comma separated values using Query Builder ?

    Open Post

    How to delete multiple records using checkbox in Laravel 5 ?

    How to delete multiple records using checkbox in Laravel 5 ?

    Open Post

    laravel 5.4 New Feature - Add eloquent whereKey method

    laravel 5.4 New Feature - Add eloquent whereKey method

    Open Post

    How to implement flash messages in PHP Codeigniter?

    How to implement flash messages in PHP Codeigniter?

    Open Post