Jump to content

Help MySQL Problem!


Recommended Posts

Using basic roleplay gamemode of vG for private purposes and non-public.

I am trying to make this script from scratch but I am having problems.

SERVER SIDED

local mysql = exports.mysql 
  
function saveFunc(xPosition, yPosition, zPosition, rotPosition, nameLocation, descriptionLocation) 
    local insertid = mysql:query_insert_free("INSERT INTO locations SET x='" .. mysql:escape_string(tonumber(xPosition)) .. "', y='" .. mysql:escape_string(tonumber(yPosition)) .. "', z='" .. mysql:escape_string(tonumber(zPosition)) .. "', rot='" .. mysql:escape_string(tonumber(rotPosition)) .. "', name='" .. mysql:escape_string(nameLocation) .."', description='" .. mysql:escape_string(descriptionLocation)  ) 
                    if (insertid) then                       
                            outputChatBox("Location:"..nameLocation.. "has successfully been saved!", source, 0, 255, 0) 
                    else 
                          outputChatBox("An error occured! Please contact an Administrator!", source, 255, 0, 0) 
                        end 
end 
addEvent("saveFunc:saveLocation", true) 
addEventHandler("saveFunc:saveLocation", root, saveFunc) 

[2015-08-07 22:59:49] INFO: MYSQL ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''\n' at line 1 

-- Near description

Link to comment
local mysql = exports.mysql 
  
function saveFunc(xPosition, yPosition, zPosition, rotPosition, nameLocation, descriptionLocation) 
    local insertid = mysql:query_insert_free("INSERT INTO locations SET x='" .. mysql:escape_string(tonumber(xPosition)) .. "', y='" .. mysql:escape_string(tonumber(yPosition)) .. "', z='" .. mysql:escape_string(tonumber(zPosition)) .. "', rot='" .. mysql:escape_string(tonumber(rotPosition)) .. "', name='" .. mysql:escape_string(nameLocation) .."', description='" .. mysql:escape_string(descriptionLocation).."'"  ) 
                    if (insertid) then                      
                            outputChatBox("Location:"..nameLocation.. "has successfully been saved!", source, 0, 255, 0) 
                    else 
                          outputChatBox("An error occured! Please contact an Administrator!", source, 255, 0, 0) 
                        end 
end 
addEvent("saveFunc:saveLocation", true) 
addEventHandler("saveFunc:saveLocation", root, saveFunc) 

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