open.mp forum
[Pawn] MySQL query doesn't trigger my function - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] MySQL query doesn't trigger my function (/showthread.php?tid=2441)



MySQL query doesn't trigger my function - dock - 2023-08-16

Hello,

I've been trying to make a command that's gonna read my logs table on my MySQL database...

Here is the code

PHP Code:
if (!strcmp(by, "Account", true)) { format(conditions, sizeof(conditions), "WHERE `Account` "); } else if (!strcmp(by, "ToAccount", true)) { format(conditions, sizeof(conditions), "WHERE `ToAccount` "); } else if (!strcmp(by, "Text", true)) { format(conditions, sizeof(conditions), "WHERE `Log` "); } if (contains == 1) { format(conditions, sizeof(conditions), "%sLIKE '%", conditions); format(conditions, sizeof(conditions), "%s%s", conditions, search); format(conditions, sizeof(conditions), "%s%%'", conditions); } else { format(conditions, sizeof(conditions), "%s= '%s' ", conditions, search); } new query[1024]; format(conditions, sizeof(conditions), "%sAND lt.LogType = '%s' ORDER BY Timestamp %s LIMIT %d", conditions, logtype, order, resultNo); mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `logs` AS l JOIN `logtypes` AS lt ON l.LogType = lt.LogTypeId %e", conditions); mysql_tquery(g_SQL, query, "LogSearchResults", "d", playerid);


The function LogSearchResults doesn't even get triggered. I printed out the query and got something that returns results when I run it manually..

Any ideas? :(

This is the print out i got:

PHP Code:
SELECT * FROM `logs` AS l JOIN `logtypes` AS lt ON l.LogType = lt.LogTypeId WHERE `Account` = 'dock' AND lt.LogType = 'localchat' ORDER BY Timestamp desc LIMIT 50



RE: MySQL query doesn't trigger my function - Radical - 2023-09-22

If there is an error in the execution of the query, the callback will not be triggered.
Did you check the mysql_log?