Jump to content

dbConnect maxing out users, then not connecting


Recommended Posts

download = false
function downloadAvatar(uName,player)
download = true
if download == true then 
outputDebugString("[Profile] Fetching profile of - "..uName..".")
	local connection = dbConnect('mysql', 'dbname='..databaseINFO.db..';host='..databaseINFO.host, databaseINFO.user, databaseINFO.pass)
	local query = dbQuery(connection, "SELECT `avatar`, `uid` FROM `mybb_users` WHERE `username` = ?", uName);
	local result = dbPoll(query, -1);
	if(result and #result >= 1) then
	if (query == nil or false) then
	return false
	end
		dbFree(query);
    	end
   end
end
addEvent("download",true)
addEventHandler("download",root,download)
[11:12:55] WARNING: download/server.lua:22: Bad usage @ 'dbConnect
' User database already has more than 'max_user_connections' active conn
ections]

Keeps giving me that error, and then stops/crashes the server.

Edited by raysmta
Link to comment

Thanks, worked like charm - 

I did something like -

details = {
  user = ""
  pass = ""
  db = ""
  }
function connect()
 -- connected it here
  if connect then
    outputDebugString("Worked")
  else
    outputDebugString("Didn't work")
  end
end
addEventHandler("onResourceStart", root, connect)

-- then called in my other function

 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...