Tag : Last


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 | | 324 Viewer | Category : MySql Codeigniter
READ MORE

How to get last 2 days records from table using Mysql Query?

We may sometimes require to get few days ago records from table like last 2 days, last 3 days, last 10 days or last 15 days etc. Most of developer choose other logic but we can easily get using mysql query(using CURDATE and INTERVAL). In this example mysql query i have one table "elements" and columns are id, title, description, created_at(timestamps) and update_at, Now we will get all records of last 2 days.so you can fetch fields value using CURDATE and INTERVAL of mysql. In following example you can see how to select data of last two days. <strong>Query:</strong> <pre> SELECT * FROM `elem.....

By Hardik Savani | July 22, 2016 | | 952 Viewer | Category : PHP MySql
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 | | 2632 Viewer | Category : Laravel
READ MORE

How to get last executed query in Larave 5?

We have been many time need to get executed query log or you want to get last executed query or maybe if you want to diaplsy sql query from laravel query builder then you can do it that. so i have three example for display executed query in Laravel 5. when you are working on laravel application at that times , i think you need many time to print last run query or if you want to check direct from phpmyadmin sql box, so at that time you have to follow this three example. so, let's see three example of getting sql query from Laravel Query Builder. <strong class="step">Example 1:</strong> In this.....

By Hardik Savani | April 10, 2016 | | 3330 Viewer | Category : Laravel
READ MORE

Git remove last commit from local

Git is distributed version control system that is a awesome. when ever you are working with git repository. if you did commit your code in your local system by mistake, then if you want to remove last commit from your project. so let's see following example: <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> git add . git commit -m "change for test" git reset --soft HEAD~ </pre>

By Hardik Savani | March 18, 2016 | | 570 Viewer | Category : Git
READ MORE

    Response download with file in Laravel 5.3 example

    Response download with file in Laravel 5.3 example

    Open Post

    How to install laravel framework on windows xampp server from scratch?

    How to install laravel framework on windows xampp server from scratch?

    Open Post

    Laravel 5 Twitter OAuth using Socialite Package

    Laravel 5 Twitter OAuth using Socialite Package

    Open Post

    Laravel 5 - elasticsearch with pagination example

    Laravel 5 - elasticsearch with pagination example

    Open Post

    Laravel 5 - generate PDF from html view file and download using dompdf

    Laravel 5 - generate PDF from html view file and download using dompdf

    Open Post

    AngularJS - How to render HTML value in ng-repeat ?

    AngularJS - How to render HTML value in ng-repeat ?

    Open Post