Home > Software design >  search registration through the year and month
search registration through the year and month

Time:07-03

I'm making a code where a record has to appear through the date (Month, Year), for example: 12-2022. But this is where it is, with this code, I'm not getting it. What can I do?

<?php
                
                $sqli=sprintf("SELECT * FROM eventos WHERE YEAR(data) = 2022/10");
                $resu=mysqli_query($con,$sqli);
                mysqli_set_charset($con, 'UTF8');
?>

CodePudding user response:

Your where clause should be separated on year and month.

The query that might work is some thing like this:

"select * from eventos where year(data) = '2022' and month(data) = 10"
  • Related