Scripting/Squirrel/Functions/mysql fetch row: Difference between revisions
Jump to navigation
Jump to search
This wiki is using an old backup from 2020
Some information may be old/missing
No edit summary |
|||
Line 17: | Line 17: | ||
local query = mysql_query(vcmpdb, "SELECT kills, deaths FROM accounts WHERE name = '"+player.Name+"'"); | local query = mysql_query(vcmpdb, "SELECT kills, deaths FROM accounts WHERE name = '"+player.Name+"'"); | ||
local stats = mysql_fetch_row(query); | local stats = mysql_fetch_row(query); | ||
ClientMessage( "Your stats - Kills: "+stats[0]+", Deaths: "+stats[1]+".",255,255,255); | ClientMessage( "Your stats - Kills: "+stats[0]+", Deaths: "+stats[1]+".",player,255,255,255); | ||
}</source> | }</source> |
Revision as of 11:14, 28 September 2015
Get a result row as an enumerated array.
Syntax
mysql_fetch_row( query );
Arguments
- query - Name of the previously executed query.
Example
function onPlayerCommand(player, cmd, parameters)
{
if (cmd == "stats")
{
local query = mysql_query(vcmpdb, "SELECT kills, deaths FROM accounts WHERE name = '"+player.Name+"'");
local stats = mysql_fetch_row(query);
ClientMessage( "Your stats - Kills: "+stats[0]+", Deaths: "+stats[1]+".",player,255,255,255);
}