In this tutorial, i will let you know 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.
So, Basically we will fetch data by using above pre-define function of MySQL. In this example i have one "users" table and there are several fields. I will get only today to next Sunday records by compare with created_at column. So you can also use this mysql query on your php project. So, let's see bellow mysql query:
SELECT *, date(now() + INTERVAL 6 - weekday(now()) DAY) as this_sunday_date
WHERE created_at <= date(now() + INTERVAL 6 - weekday(now()) DAY)
AND created_at >= CURRENT_TIMESTAMP
This query is very small but it can help you more.