Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. local serverDatabase
  2.  
  3. local db = {}
  4. local db["Name"] = ""
  5. local db["User"] = ""
  6. local db["Password"] = ""
  7. local db["Host"] = ""
  8.  
  9. addEventHandler("onResourceStart", getResourceRootElement(),
  10. function ()
  11. serverDatabase = dbConnect("mysql", "dbname=" .. db["Name"] .. ";host=" .. db["Host"] ..";charset=utf8", db["User"], db["Password"], "tag=lastdb;multi_statements=1")
  12.  
  13. if not serverDatabase then
  14. outputServerLog("[MySQL]: Failed to connect the database.")
  15. outputDebugString("[MySQL]: Sikertelen kapcsolódás az adatbázishoz!", 1)
  16. cancelEvent()
  17. else
  18. dbExec(serverDatabase, "SET NAMES utf8")
  19. outputDebugString("[MySQL]: Sikeres kapcsolódás az adatbázishoz.")
  20. end
  21. end
  22. )
  23.  
  24. function getConnection()
  25. return serverDatabase, db
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement