Garry's Mod Wiki


table sql.Query( string query )


Performs a query on the local SQLite database, returns a table as result set, nil if result is empty and false on error.


1 string query
The query to execute.


1 table
false is returned if there is an error, nil if the query returned no data.


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

function CreateTable() sql.Query("CREATE TABLE player_data(SteamID TEXT, Money INTEGER)") end function NewPlayerToDataBase(ply) sql.Query("INSERT INTO player_data(SteamID, Money) VALUES('"..ply:SteamID().."', 0)") end function SavePlayerToDatabase(ply, Money) sql.Query("UPDATE player_data SET Money="..Money.." WHERE SteamID='"..ply:SteamID().."'") end

Page Links

Special Pages



Render Time: 33ms

DB GetPage 4
Generate Html 5
SaveChanges (1) 9
Render Body 0
Render Sidebar 12