20.11.2018, 19:59
(
Последний раз редактировалось =KempeR=; 20.11.2018 в 20:01.
Причина: Wrapped code to cuter [PHP] tag :D
)
At first. The best idea is to store date in temporal types such as DATE, DATETIME, TIMESTAMP.
Secondly. Applying functions to table fields is undesirable in any DBMS.
And further. Avoid using mysql_query. Better use threaded mysql queries - mysql_tquery
The use of SQL functions on field can not be avoided here, so the working code should look like this:
Secondly. Applying functions to table fields is undesirable in any DBMS.
And further. Avoid using mysql_query. Better use threaded mysql queries - mysql_tquery

The use of SQL functions on field can not be avoided here, so the working code should look like this:
PHP код:
CMD:lastlog(playerid)
{
mysql_tquery(
SQL,
"SELECT * FROM `users` WHERE str_to_date(`LastLog`, '%%d/%%m/%%Y') <= NOW() - INTERVAL 30 DAY ORDER BY `ID` DESC LIMIT 20",
"lastLogResponse", "d", playerid
);
return 1;
}
forward lastLogResponse(playerid);
public lastLogResponse(playerid)
{
new szResult[32], szDialog[652] = "ID\tLastLog"; // IDK how long is data that u retrieve from database;
for (new i = 0, rowCount = cache_num_rows(); i < rowCount; i++)
{
cache_get_field_content(i, "LastLog", szResult);
format(string, sizeof(string), "%s\n%d\t%s", i + 1, szDialog, szResult);
}
ShowPlayerDialog(playerid, 123, DIALOG_STYLE_TABLIST_HEADERS, "LastLog", szDialog, "Select", "Close");
return 1;
}

