Saving data into SQL with extension

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Saving data into SQL with extension

Post by kaligus »

Hello,

please, I'm trying to save some data into MySQL and it just does not save... the code is all right... the information goes ok into cmd server (via trace command) and go ok to my game client, but it does not save into my MySQL table.

Look the code:

Code: Select all

dp.xt = queryRes.get(0).getItem("xptotal")
            dp.pts = queryRes.get(0).getItem("pontos")
            dp.din = queryRes.get(0).getItem("money")
            dp.niv = queryRes.get(0).getItem("nivel")
            dRet.xn = parseInt(dp.xt) + parseInt(dRet.XP) //xp novo
            dRet.dn = parseInt(dp.din) + parseInt(dRet.din) //dindin novo
            trace ("Total de " + dRet.xn + " XP e " + dRet.dn + " Moedas")

            sql = "UPDATE psng_dados SET "
            sql += " xptotal = '" + dRet.xn + "' AND "
            sql += " money = '" + dRet.dn + "' WHERE "
            sql += " nick = '" + nick + "' "
            var atualizar = db.executeCommand(sql)
            if (atualizar){
                //ok
                trace ("OK")
            } else {
                dRet._cmd = "nook"
            }
You can see that I convert the values to INT, in trace command, the sum returns ok (right value), but it just dont save into MySQL (like nothing happens).

Can you help with this?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Are there any errors on the server side after the query?
If the OK message is returned there's no good reason why data shouldn't have been saved.
Lapo
--
gotoAndPlay()
...addicted to flash games
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Post by kaligus »

That's the strange point :lol:

No errors in server side, the confirmation message in my serverside script works. It just does not save into MySQL.

I will check this again this week (working in another project now)... but if possible, can you make a test on your own? Then we can check if is it a bug or something.

Thanks for the reply, Lapo.
Post Reply