PBusiness.QueryDatabase - XxLMM13xXgaming/pro_business GitHub Wiki

PBusiness.QueryDatabase

This function will run a query in the owners mysql method (tmysql or mysqloo) It is very important that you read this whole doc because you will need to know how you can receive the info!

Args

For this function there are 2 args...

query, queryid

query: The mysql query to run

queryid: A set of numbers (please use math.random(1,999) or just math.random()) to use to identify that query and call back info later!

Code example

local thequeryid = math.random(1,9999)
PBusiness.QueryDatabase("SELECT * FROM players", thequeryid)
timer.Create("PBusinessQueryDatabaseResults"..thequeryid, 1, 0, function()
    for k, v in pairs(PBusiness.ServerQuerys) do
        if v[1] == thequeryid then
            timer.Remove("PBusinessQueryDatabaseResults"..thequeryid)
            PrintTable(v)
        end
    end
end)

The code above will query the database then create a timer to wait for the results then remove the timer when they are found and print the whole info we can get about the query.. if you want JUST the query results you will need to call v[3] i hope to make this better at some point but for now this is how it is!