1
I have a system where I need to select any date in a calendar, so I need to return all the month records of that date, for example: I have 4 dates, 01/08/2017, 06/08/2017, 14/09/2017, 17/10/2017. Suppose I clicked on the date "01/08/2017" and mine query must return all dates recorded in the month of August. In this case the return has to be 01/08/2017 and 06/08/2017.
Follow the code of how I tried to do.
if (isset($_POST['calendar']) AND $_SERVER['REQUEST_METHOD'] == 'POST'){
$date = $_POST['date'];
$cashier = listarColunas("cashier", " DATE_FORMAT(cas_day,'%d/%m/%Y') as
cas_day", "WHERE MONTH(cas_day) = '10'");
The field cas_day
is where I store the date, but I needed to break it into 3 parts, because that way did not work.
Note: This is my function
listarColunas($tabela, $colunas, $parametros = null)
If your problem is to search in Mysql for the month of a date obtained in PHP, wouldn’t it be better if the title reflected this? From what I understand the need to break the date at 3 comes from an attempt to solve, not the problem itself.
– nunks