Jump to content

executeSQLUpdate


UAEpro

Recommended Posts

Posted

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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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 ) 
  
  

تيم سبيك بروجيمر

ts3server://ts.pg.sa

Posted
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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Is the table created? does the map exists in the table?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

تيم سبيك بروجيمر

ts3server://ts.pg.sa

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