пытаюсь сделать пользовательскую функцию:
Выдает ошибку:function doc_num($prefix, $num_field, $date_field, $entity_id)
{
$year = date("y",[$date_field]);
$max_date_query=db_query('select max(field_'.$date_field.') as max_date from app_entity_'.$entity_id.' where FROM_UNIXTIME(field_'.$date_field.', "%y")='.$year);
if($max_date_arr = db_fetch_array($max_date_query)){
$max_date = $max_date_arr['max_date'];
}
....
Не могу понять, что не так.. Возможно "%y" в FROM_UNIXTIME(field_'.$date_field.', "%y") нужно как-то по другому прописывать.. Но пробовал по всякому и так \"\%y\" и так \'%y\' и \'\%y\', все равно ошибку выдает.Database Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
Query: select max(field_742) as max_date from app_entity_49 where FROM_UNIXTIME(field_742, "%y")=
Page: /index.php?module=dashboard/ajax_request&field_id=925&item_id=0
#0 includes/functions/database.php(87): mysqli_query(Object(mysqli), 'select max(fiel...')
#1 includes/classes/custom_php.php(22) : eval()'d code(4): db_query('select max(fiel...')
#2 modules/dashboard/actions/ajax_request.php(109) : eval()'d code(20): doc_num('IEOF-', 430, 742, 49)
#3 modules/dashboard/actions/ajax_request.php(109): eval()
#4 index.php(20): require('/home/users/i/i...')
#5 {main}

