Jump to content
  • 0

Query does not update the record. Quest


kubasiek221

Question

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

4 answers to this question

Recommended Posts

  • 0
  • Premium

id is a number not a string, remove the ''

 

Are you sure it's not updating? You are not updating the id1 variable so it will show the same number both times.

  • Love 1

Currently working on my FreeBSD blog:

FreeBSD is Fun, practical tutorials and articles

⚠️                Are you under attack?               ⚠️

Link to comment
Share on other sites

  • 0

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

  • 0

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

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


  • Activity

    1. 0

      damage from int to long long

    2. 22

      Green & Purple Potions Effect

    3. 12

      When Uninstalling Gaya System

    4. 12

      When Uninstalling Gaya System

    5. 12

      When Uninstalling Gaya System

    6. 12

      When Uninstalling Gaya System

    7. 12

      When Uninstalling Gaya System

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.