Jump to content

Query does not update the record. Quest


Go to solution Solved by kubasiek221,

Recommended Posts

Hey!

 

My quest does not work.

Query UPDATE does not update the record mysql with cash. Why ?

State coins shows correctly.

How fix the problem ?

Please, help me.

http://wklej.to/FVkvp

quest test begin
	state start begin
		when 9001.click begin
			say_title(" xx ")
			local cost = 100
			local id1 = query("SELECT cash FROM account.account WHERE id ='"..pc.get_account_id().."';")
			say(" Current state your coins: "..id1.." ")
			wait()
			query("UPDATE account.account SET cash=cash-"..cost.." WHERE id='"..id1.."';")
			say(" Click continue ")
			wait()
			say("Your money: "..id1)
		end
	end
end
Link to comment
Share on other sites

Hay, I fix the problem, but i have new problem.

Quest not checkingmy condition ( if id1 >= 100 then ). When click "Continue" nothing happens.

Why ?

quest test begin
    state start begin
        when 9001.click begin
            say_title(" xx ")
            local cena = 100
            local id1 = query("SELECT cash FROM account.account WHERE id ='"..pc.get_account_id().."';")
            say(" State your money : "..id1.." ")
            wait()
            if id1 >= 100 then -- this if does not work
                query("UPDATE account.account SET cash=cash-"..cena.." WHERE id='"..pc.get_account_id().."';")
                local current = id1-100
                say("Current state your money:: "..current.." ")
            else
                local new = 100-id1
                say(" Your money is so small, you need: "..new.." SM! ")
            end
        end
    end
end
Link to comment
Share on other sites

Try this:

quest test begin
    state start begin
        when 9001.click begin
            say_title(" xx ")
            local cena = 100
            local id1 = query("SELECT cash FROM account.account WHERE id ='"..pc.get_account_id().."';")
            say(" State your money : "..id1.cash[1].." ")
            wait()
            if tonumber(id1.cash[1]) >= 100 then -- this if does not work
                query("UPDATE account.account SET cash=cash-"..cena.." WHERE id='"..pc.get_account_id().."';")
                local aktualne = tonumber(id1.cash[1])-100
                say("Current state your money:: "..aktualne.." ")
            else
                local new = 100-tonumber(id1.cash[1])
                say(" Your money is so small, you need: "..new.." SM! ")
            end
        end
    end
end
  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.