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(conditionssizeof(conditions), "WHERE `Account` ");
}
else if (!
strcmp(by"ToAccount"true)) {
format(conditionssizeof(conditions), "WHERE `ToAccount` ");
}
else if (!
strcmp(by"Text"true)) {
format(conditionssizeof(conditions), "WHERE `Log` ");
}

if (
contains == 1) {
format(conditionssizeof(conditions), "%sLIKE '%"conditions);
format(conditionssizeof(conditions), "%s%s"conditionssearch);
format(conditionssizeof(conditions), "%s%%'"conditions);
}
else {
format(conditionssizeof(conditions), "%s= '%s' "conditionssearch);
}

new 
query[1024];
format(conditionssizeof(conditions), "%sAND lt.LogType = '%s' ORDER BY Timestamp %s LIMIT %d"conditionslogtypeorderresultNo);
mysql_format(g_SQLquerysizeof(query), "SELECT * FROM `logs` AS l JOIN `logtypes` AS lt ON l.LogType = lt.LogTypeId %e"conditions);
mysql_tquery(g_SQLquery"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?