G.SQLStr

From GMod Wiki

Jump to: navigation, search
Function
Syntax SQLStr( String value )
Where is this used?
Description:
Returns a string value that is safe to insert into an SQL statement
Returns: String
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.SQLStr]G.SQLStr [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionEscapes the player name The "Big" Cahoon and queries the database.
Used onNewerShared.png
Code
sql.Query( "SELECT * FROM names WHERE name = " .. SQLStr( ply:Name() ) )
OutputResultant Query: SELECT * FROM names WHERE name = "The \"Big\" Cahoon"'


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox