How to fetch data from sql if its equal to today date in PHP MySQL

How to fetch data from sql if its equal to today date in PHP MySQL

// Your Query is like this.

$query = "SELECT *,DATE_FORMAT(`codelizar_tbl`.`column_date`, '%Y-%m-%d') FROM `codelizar_tbl` WHERE DATE(`column_date`) = CURDATE()";

Now Explain:-

Here is your query – it’s collect the data from table, but it’s collect the data behalf on of from today date if today date is found in table it retrieve the data as a result.

Table Name – `codelizar_tbl`

Column Name – `column_date`

CURDATE – is :

The CURDATE() is a sql function it returns the today’s date.

Note: The date is returned as “YYYY-MM-DD” (string) or as YYYYMMDD (numeric).

Note: This function equals the CURRENT_DATE() function.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *