Scripting/Squirrel/Functions/mysql num rows: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
(Created page with "Returns the number of rows selected from a query. == Syntax == <pre>mysql_num_rows( query );</pre> == Arguments == * ''string'' '''query''' - The name of the previously ex...") |
No edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
== Arguments == | == Arguments == | ||
* | * '''query''' - The name of the previously executed query. | ||
== Example == | == Example == | ||
Line 13: | Line 13: | ||
<source lang=squirrel>function onPlayerJoin() | <source lang=squirrel>function onPlayerJoin() | ||
{ | { | ||
query<- mysql_query(vcmpdb, "SELECT * FROM bans WHERE IP = '"+player.IP+"'"); | local query<- mysql_query(vcmpdb, "SELECT * FROM bans WHERE IP = '"+player.IP+"'"); | ||
if (mysql_num_rows(query)==0) | if (mysql_num_rows(query)==0) | ||
{ | { | ||
Line 20: | Line 20: | ||
else player.Kick(); | else player.Kick(); | ||
}</source> | }</source> | ||
== Related Functions == | |||
{{Scripting/Squirrel/Functions/MySQL Functions}} | |||
[[Category:Scripting/Squirrel/Functions/Mysql_Functions]] |
Latest revision as of 18:28, 30 January 2017
Returns the number of rows selected from a query.
Syntax
mysql_num_rows( query );
Arguments
- query - The name of the previously executed query.
Example
function onPlayerJoin()
{
local query<- mysql_query(vcmpdb, "SELECT * FROM bans WHERE IP = '"+player.IP+"'");
if (mysql_num_rows(query)==0)
{
ClientMessage("Welcome.",player,255,255,255);
}
else player.Kick();
}