CURRENT_DATE PROBLEM
CURRENT_DATE PROBLEM

Hi guys,
to bypass the "datapicker" issue that I'm not able to import into my code, because I'm ignorant and ashamed of it, I thought of a solution to this code:
Editor::inst( $db, 'scrivania1', 'id' )
->fields(
Field::inst( 'ddt' ),
Field::inst( 'cliente' ),
Field::inst( 'carico' ),
Field::inst( 'destinazione' ),
Field::inst( 'pr' ),
Field::inst( 'scarico' ),
Field::inst( 'scarico_m' ),
Field::inst( 'data_di_scarico' )
->validator( Validate::dateFormat( 'd/m/Y' ) )
->getFormatter( Format::dateSqlToFormat( 'd/m/Y' ) )
->setFormatter( Format::dateFormatToSql( 'd/m/Y' ) ),
Field::inst( 'epal' ),
Field::inst( 'ind' ),
Field::inst( 'perd' ),
Field::inst( 'dati_di_scarico' ),
Field::inst( 'drit' ),
Field::inst( 'trit' ),
Field::inst( 'dlinea' ),
Field::inst( 'tlinea' ),
Field::inst( 'note' ),
Field::inst( 'active' )
->setFormatter( function ( $val, $data, $opts ) {
return ! $val ? 0 : 1;
} )
)
I would add this clause:
->where ('data_di_scarico' = Current_Date)
But on phpmyadmin it works for me and from here it doesn't, why?
And return me the errorr TN/1
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
https://editor.datatables.net/manual/php/conditions
When you read and follow the instructions at that tech note, what do you see the server responding with. I would expect it to be an error message explaining what the issue is.
It's because your PHP is not valid. First
Current_Date
above is a _constant (which you presumably don't have defined) and second you are attempting to assign it to a string as a value in a method call parameter.What I would suggest is that you get the current date using PHP's date() method. e.g.:
Allan
@allan, "Current_Date" is MySQL syntax and unknown to PHP. It is the same as MySQL "curdate()".
Both MySQL-functions (or whatever they are called) return this for today: 2020-03-28
So I would rewrite your line like this to achieve the same result:
Ty @allan and @rf1234 u are the best!