Modules/MySQL/MysqlCreate: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
Line 5: Line 5:


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">mysql mysqlCreate ( nil )</syntaxhighlight>
<syntaxhighlight lang="lua">mysql mysqlCreate ( )</syntaxhighlight>


===Required Arguments===
===Required Arguments===

Latest revision as of 20:47, 29 September 2009


Package-x-generic.png This function is provided by the external module MySQL. You must install this module to use this function.


This function creates a MySQL object which you can use to communicate with a database.

Syntax

mysql mysqlCreate ( )

Required Arguments

None

Optional Arguments

None

Example

function onMySQLOpen ( result )
	if ( result ) then
		outputServerLog ( "MySQL connection established." )
		mysqlQuery ( db, "onMySQLResult", "SELECT * FROM test" )
	else
		outputServerLog ( "MySQL connection failed." )
	end
end

function mysqltest ()
	db = mysqlCreate ()
	mysqlOpen ( db, "onMySQLOpen", "localhost", "bastage", "bastage_pw", "test", 3306 )
end