sconer Posted October 5, 2013 Share Posted October 5, 2013 Hello, i want to connect to mysql in my server. But i don't know what eventhandler i need to call to connect to the mysql. Who knows please reply to this thread. Thanks. function mysqlconnect() handler = mysql_connect("localhost", "root", "", "crpmta") -- Establish the connection if ( not handler ) then -- The connection failed outputDebugString("Unable to connect to the MySQL server") else mysql_close(handler) -- Close the connection end end Link to comment
Chopper Posted October 5, 2013 Share Posted October 5, 2013 You can use any event handler. There isnt a specific one for mysql connections. Link to comment
Castillo Posted October 5, 2013 Share Posted October 5, 2013 If you want it to connect to the MySQL server when the resource starts, then you can use onResourceStart. function mysqlconnect ( ) handler = mysql_connect ( "localhost", "root", "", "crpmta" ) -- Establish the connection if ( not handler ) then -- The connection failed outputDebugString ( "Unable to connect to the MySQL server" ) else mysql_close ( handler ) -- Close the connection end end addEventHandler ( "onResourceStart", resourceRoot, mysqlconnect ) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now