Okay, I think I understand now the syntax of the DATE_FORMAT SQL order.
But I have to ask the question the other way: Can you please make this php code with the SQL clause "WHERE sh.session_lastaction =" to run, I dont know how to get the variables 'today' and 'month', so my idea of the php code with sql query is:
//-----------------------------------------------------
//--- total user sessions today------------------------
//-----------------------------------------------------
$sql = "SELECT COUNT(*) as sessions
FROM (".SESSIONS_HIST_TABLE." sh, " . SESSIONS_TABLE . " s)
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = sh.session_user_id)
WHERE sh.session_lastaction = today and " . get_user_table_field("u.", "user_level") . " >= '" . GUEST . "' AND " . get_user_table_field("u.", "user_level") . " <= '" . USER . "'
GROUP BY s.session_ip";
$counter_result_day = $site_db->query_firstrow($sql);
and
//-----------------------------------------------------
//--- total user sessions this month ------------------
//-----------------------------------------------------
$sql = "SELECT COUNT(*) as sessions
FROM (".SESSIONS_HIST_TABLE." sh, " . SESSIONS_TABLE . " s)
LEFT JOIN " . USERS_TABLE . " u ON (" . get_user_table_field("u.", "user_id") . " = sh.session_user_id)
WHERE sh.session_lastaction = month and " . get_user_table_field("u.", "user_level") . " >= '" . GUEST . "' AND " . get_user_table_field("u.", "user_level") . " <= '" . USER . "'
GROUP BY s.session_ip";
$counter_result_month = $site_db->query_firstrow($sql);
thkyou
chris