Jump to content

[Help] toJSON/fromJSON


Tekken

Recommended Posts

Posted

HI, i need some help on toJSON and fromJSON.

My problem is this:

I save ID, NUMBER like this:

local json = toJSON({ ID, NR }) 

Everything work's ok but I need to save like 20 ID's and 20NR's but each time will overwrite the old ID/NR and I don't want that...

Any help ?

Posted

I can't show my full code but

SAVE

local theID = getElementModel(element) 
local thenr = getElementHealth(element) 
local json = toJSON({theID, theNr}) 
--- Bla, bla 
dbQuery(db, "INSERT INTO table(json) VALUE(?)", json) 

LOAD

local theID, theNr = unpack(fromJSON(json)) 

Posted

Do you know how to/fromJSON work's ? when i send that data in THE SAME json will OVERRITE old data! and keep only the last one.

Posted

Do you know how to/fromJSON work's ? when i send that data in THE SAME json will OVERRITE old data! and keep only the last one.

Man you are inserting new values every time did you tired :

dbExec(db, "UPDATE table(json) SET value = ? WHERE yourData = ?", json) 

Posted

Do you know how to/fromJSON work's ? when i send that data in THE SAME json will OVERRITE old data! and keep only the last one.

Man you are inserting new values every time did you tired :

dbExec(db, "UPDATE table(json) SET value = ? WHERE yourData = ?", json) 

this will just give NULL.

Posted (edited)
dbExec(db, "UPDATE table(json) SET value = ? WHERE yourData = ?", json) 

this will just give NULL.

maybe you did something wrong that's why i asked you to show me your code.

Edited by Guest
Posted

Everything works ok only that thing, and i think that's normal, I came here because i thought somebody will give me a better idea.

Posted
How we can help you if you dont want to show us your full codes? and the way that you reply us is so rude

I was a bit angry because i have some problems, but you didn't want to understand.

Posted
How we can help you if you dont want to show us your full codes? and the way that you reply us is so rude

I was a bit angry because i have some problems, but you didn't want to understand.

Bro how we suppose to know what is creating problem, you need to show us your full code because it's the only one solution.

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