22.10.2018, 09:56
Quote:
you'd have to run another query after inserting the new report which would select from the reportlog table ordered by id in a descending order with a limit of 1 to ensure you're selecting the latest entry to the database
|
Zeus666, always escape input by players to avoid SQL injection.
Read about %e placeholder: https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_format
pawn Код:
mysql_format(..., "INSERT INTO ...", ...);
mysql_tquery(handle, jQuery, "OnPlayerReport", "dds", playerid, targetid, reason);
strings do not require length either.
pawn Код:
forward OnPlayerReport(playerid, targetid, reason[]);
public OnPlayerReport(playerid, targetid, reason[])
{
if (cache_affected_rows(handle))
{
// send messages and start the timer
}
}
Now if a new row is inserted, it will affect 1 row obviously.