• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] MySQL query doesn't trigger my function
#1
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 
  Reply


Messages In This Thread
MySQL query doesn't trigger my function - by dock - 2023-08-16, 05:43 PM