SA-MP Forums Archive
How to compare Mysql queries? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to compare Mysql queries? (/showthread.php?tid=550789)



How to compare Mysql queries? - Axnon - 14.12.2014

Basically i have this code:

pawn Код:
format(query, sizeof(query), "SELECT `faction` FROM `users` WHERE `name` = '%s'", name);
mysql_function_query(dbHandle, query, false, "", "");
format(query, sizeof(query), "SELECT `faction` FROM `users` WHERE `name` = '%s'", GetName(playerid));
mysql_function_query(dbHandle, query, false, "", "");
How do i compare both of those results, they will return a number from the database, if that helps.


Re: How to compare Mysql queries? - Vince - 14.12.2014

Why the hell do you even need the two queries? You can use OR (WHERE name = x OR name = y). And what do you mean by "compare"?


Re: How to compare Mysql queries? - Axnon - 15.12.2014

It's to kick a player from a faction, when he's offline, basically, this compares if both players are in the same faction, if they are the command proceeds to kicking the other player.

The problem is i have no idea how to do that in PAWN, since i'm somewhat new to it.


Re: How to compare Mysql queries? - Lordzy - 15.12.2014

Instead of two queries you can simply run one query and check if multiple rows are retrieved.