Jump to content

[Help] Loading mysql issues.


Ben_Sherman

Recommended Posts

Hi there,

I'm still kinda new to lua coding but so far I'm doing good I guess, I'm working on a mod handler which will be toggled by a GUI where you can select mods and then it start downloading the file. I got some issues when loading the data from the database. I've printed every single thing but in the database the value is 0 on all of the mod lines which it doesn't print. Everytime I print it the value just increases starting from 1 and I press again it increases to 2, so it's kinda like it's printing each time I'm pressing the button... Any suggestions here?

addEventHandler("LoadSettings", getRootElement(),  
    function (thePlayer) 
        local to = client 
        local toID = getElementData( to, "account:id" ) 
        local query1 = mysql:query("SELECT id FROM modsettings WHERE username='"..toID.."'") 
        if (mysql:num_rows(query1) == 0) then 
            local setsettings = mysql:query("INSERT INTO modsettings (`username`) VALUES ('"..toID.."')") 
        else 
            local query = mysql:query("SELECT mod1 FROM modsettings WHERE username='"..toID.."'") 
            local field = "" ..query.. "" 
            mysql:free_result(query) 
            outputDebugString("Mod Package 1 "..field) ----- HERE------ 
            local query = mysql:query("SELECT mod2 FROM modsettings WHERE username='"..toID.."'") 
            local field = "" ..query.. "" 
            mysql:free_result(query) 
            outputDebugString("Mod Package 2 "..field) ----- HERE------ 
            local query = mysql:query("SELECT mod3 FROM modsettings WHERE username='"..toID.."'") 
            local field = "" ..query.. "" 
            mysql:free_result(query) 
            outputDebugString("Mod Package 3 "..field) ----- HERE------ 
        end 
    end 
); 

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