Garry's Mod Wiki

Garry's Mod Wiki

  string sql.QueryValue( string query )

Description

Performs the query like sql.QueryRow, but returns the first value found.

Arguments

1 string query
The input query.

Returns

1 string
The returned value.

Example

Functions that are examples of saving and creating information into the database.

function CreateTable() sql.Query("CREATE TABLE IF NOT EXISTS player_data ( SteamID64 INTEGER PRIMARY KEY, Money INTEGER )") end function SavePlayerToDataBase(ply, money) sql.Query("INSERT OR REPLACE INTO player_data ( SteamID64, Money ) VALUES ( " .. ply:SteamID64() .. ", " .. money .. " )") end function LoadPlayerFromDataBase(ply) return sql.QueryValue("SELECT Money FROM player_data WHERE SteamID64 = " .. ply:SteamID64()) end

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...