Jump to content

executeSQLUpdate


UAEpro

Recommended Posts

Try with this:

function addlike() 
    local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE mapName='".. tostring(mapName) .."'") 
    local update = result[1]["ratingLike"] +1 
executeSQLUpdate ( "MapName2", "ratingLike = '".. update .."'","mapName = '" .. tostring(mapName) .. "'") 
end 
addCommandHandler ( "like", addlike ) 
--------------- 
function addunlike() 
    local result = executeSQLQuery("SELECT ratingUnLike FROM MapName2 WHERE mapName='".. tostring(mapName) .."'") 
    local update = result[1]["ratingUnLike"] +1 
executeSQLUpdate ( "MapName2", "ratingUnLike = '".. update .."'","mapName = '" .. tostring(mapName) .. "'") 
end 
addCommandHandler ( "unlike", addunlike ) 

Link to comment

my Table was

executeSQLCreateTable ( "MapName2","map_name TEXT,ratingLike INTEGER, ratingUnlike INTEGER" ) 
  

so i edit the line

local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE mapName='".. tostring(mapName) .."'")

but also i got error

attempt to index field '?' ( a nil value) line 19

line 19 =

  
    local update = result[1]["ratingLike"] +1 
  

  
function addlike() 
    local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") 
    local update = result[1]["ratingLike"] +1 
executeSQLUpdate ( "MapName2", "ratingLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") 
end 
addCommandHandler ( "like", addlike ) 
--------------- 
function addunlike() 
    local result = executeSQLQuery("SELECT ratingUnLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") 
    local update = result[1]["ratingUnLike"] +1 
executeSQLUpdate ( "MapName2", "ratingUnLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") 
end 
addCommandHandler ( "unlike", addunlike ) 
  
  

Link to comment
function addlike() 
    local result = executeSQLQuery("SELECT ratingLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") 
    local update = tonumber(result[1]["ratingLike"]) + 1 
executeSQLUpdate ( "MapName2", "ratingLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") 
end 
addCommandHandler ( "like", addlike ) 
--------------- 
function addunlike() 
    local result = executeSQLQuery("SELECT ratingUnLike FROM MapName2 WHERE map_name='".. tostring(mapName) .."'") 
    local update = tonumber(result[1]["ratingUnLike"]) + 1 
executeSQLUpdate ( "MapName2", "ratingUnLike = '".. update .."'","map_name = '" .. tostring(mapName) .. "'") 
end 
addCommandHandler ( "unlike", addunlike ) 

Link to comment

in line #12

outputChatBox("This map has #00FF00 ".. result[1].ratingLike .." Likes", g_Root, 225, 170, 90, true)

in the chat box i sow 0 Likes ^^

and yes there is a table

alrams.net-08d8bfd843.png

i edit the table and make the like 5 and i got like 5 in the chatbox so everything is ok up

edit : 5 likes in all maps >.< WTF

edit: now i know where the error

edit

FIXED Everyting

Link to comment

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