Tag : Now



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 | | 3256 Viewer | Category : PHP MySql
READ MORE

How to get current year rows using MySql Query PHP?

If you require to get all the records of current year using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this year. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current year. <strong>Example:</strong> <pre> SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 YEAR); </pre>

By Hardik Savani | June 14, 2016 | | 1417 Viewer | Category : MySql
READ MORE

How to get current month data in MySql PHP ?

If you require to get all the records of current month using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this month. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current month. <strong class="example">Example:</strong> <pre class="language-mysql">SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 MONTH);</pre>

By Hardik Savani | March 17, 2016 | | 4726 Viewer | Category : PHP MySql
READ MORE

    How to call AngularJS controller function in Jquery?

    How to call AngularJS controller function in Jquery?

    Open Post

    Laravel 5 create and download zip file example using chumper/zipper composer package

    Laravel 5 create and download zip file example using chumper/zipper composer package

    Open Post

    PHP AngularJS CRUD with Search and Pagination Example From Scratch

    PHP AngularJS CRUD with Search and Pagination Example From Scratch

    Open Post

    Laravel 5 email verification with activation code example

    Laravel 5 email verification with activation code example

    Open Post

    Bootstrap form validation example with demo using validator.js plugin

    Bootstrap form validation example with demo using validator.js plugin

    Open Post

    Laravel 5 dynamic autocomplete search using select2 JS Ajax - Part 1

    Laravel 5 dynamic autocomplete search using select2 JS Ajax - Part 1

    Open Post