Modules/MySQL/MysqlCreate

From Multi Theft Auto: Wiki
Revision as of 21:59, 29 January 2007 by IJs (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


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 ( nil )

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