Hello guys, I'm having some problems with SQL. When I insert rows into columns and update it with new values so the old ones are replaced with the new ones, right?
Ok so the second question is that how do I loop through the rows? It still keep giving me the same 100 value.
function SQLTest()
if executeSQLQuery("CREATE TABLE IF NOT EXISTS aa(Name TEXT, Cash NUMBER, Health NUMBER)") then
if executeSQLQuery("INSERT INTO aa(Name, Cash, Health) VALUES(?,?,?)", "myName", 1554, 100 ) then -- 100 health
local asa = 150 + getElementHealth(getPlayerFromName("What?")) -- should be 100 + now
if executeSQLQuery("UPDATE aa SET Name = ?,Cash= ?,Health = ? WHERE Health = '"..asa.."'", "myName", 140, 100) then -- executed
local Health = executeSQLQuery("SELECT * FROM aa WHERE Health = ?", 100) -- selected
if #Health ~= 0 then
outputChatBox ( Health[1]["Health"] ) -- but still the same 100
end
end
end
end
end
SQLTest()
This outputs 100? I think I'm updating it incorrectly any idea?