In this post, i am going to share with you how to get records of today to weekend by using mysql query. This is MySQL Query that you can easily use in your core PHP and PHP framework like Laravel, Codeigniter, cakephp etc project.
If you require to get records this way, today is Tuesday and you need to get data from today to next Sunday that means Tuesday to Sunday. sometimes we require to fetch records from this way. It is not any predefine function for getting records this way but we can do it by using following MySQL pre-define function.
We should know what is database seeder in laravel and why we should use before start example of database seeding. Laravel provides a tool to add sample or dummy data to our databases automatically. that is call it database seeding.
Laravel database seeder through we can add simply testing data on our database table. Database seed is extremely useful because testing with various data allows you to likely detect bugs you otherwise would have overlooked. We have to simple make one time seeder with some dummy data, that way we can simply reuse when you deploy project first time. We can make seede.....
If you are new and you want to get attribute value then you can get easily. sometime maybe we also need to get custom attribute value, i mean data attribute value. In following example i give you three way to get custom attribute value in jquery.
<pre class="prettyprint lang-html">
<title>Get Custom Attribute Value</title>
<a href="example.com" data-id="1" myname="hd">Ex.....
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.
<pre class="language-mysql">SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 MONTH);</pre>