Report bug
#9

Quote:
Originally Posted by Chyakka
Посмотреть сообщение
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
Two queries consecutively will not work as he is using threaded queries. When a new row is inserted, you know it if you pass a callback in mysql_tquery.


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);
"u" specifier is ONLY used in sscanf. Read about format specifiers: https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_tquery
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
    }
}
`reason` is an array so it needs []

Now if a new row is inserted, it will affect 1 row obviously.
Reply


Messages In This Thread
Report bug - by Zeus666 - 21.10.2018, 22:05
Re: Report bug - by v1k1nG - 21.10.2018, 22:48
Re: Report bug - by Zeus666 - 21.10.2018, 22:51
Re: Report bug - by Jefff - 21.10.2018, 23:11
Re: Report bug - by Chyakka - 21.10.2018, 23:15
Re: Report bug - by Zeus666 - 21.10.2018, 23:30
Re: Report bug - by Zeus666 - 21.10.2018, 23:53
Re: Report bug - by Zeus666 - 22.10.2018, 09:09
Re: Report bug - by Calisthenics - 22.10.2018, 09:56
Re: Report bug - by Zeus666 - 22.10.2018, 11:37

Forum Jump:


Users browsing this thread: 1 Guest(s)