Jump to content

dbPoll


WhoAmI

Recommended Posts

Hi guys.

addEventHandler("onResourceStart", resourceRoot, 
    function () 
        local query = dbQuery(handler, "SELECT * FROM pacholki") 
        if (query) then 
            local data, rows = dbPoll(query, -1) 
            if (rows > 0) then 
                for k,v in ipairs(data) do 
                    local id = v["id"] 
                    local x = v["x"] 
                    local y = v["y"] 
                    local z = v["z"] 
                     
                    outputChatBox(v) 
                    local pacholek = createObject(1459, x, y, z) 
                    setElementData(pacholek, getResourceName(resource)..":id", id) 
                    setElementData(pacholek, getResourceName(resource)..":pacholek", true) 
                end 
            end 
        end 
    end 
) 

Well, I did this, but only creates one of 3 elements. Yea, in database are 3 rows, it spawns only 1. Solutions?

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...