Jump to content

Problem with SQL syntax


Edikosh998

Recommended Posts

Hi everyone, I've got a problem with SQL syntax :

  
function SQLTableStart() 
executeSQLCreateTable("jugadores", "Name TEXT,columnAccount TEXT") 
executeSQLCreateTable("cordes","ID STRING,columnX FLOAT,columnY FLOAT,columnZ FLOAT") 
end 
addEventHandler("onResourceStart",resourceRoot,SQLTableStart) 
  
function creacio(_,account) 
  
local dataDos = getAccountData(account,"edad") 
local username = getAccountName(account) 
local name = getPlayerName(source) 
    if account then 
    local data = getAccountData(account,"LARP.player") 
    local dataDos = getAccountData(account,"LARP.Actual") 
    local dataTres = getAccountData(account,"LARP.edad") 
     
        if not data then 
        showCursor(source,true) 
        triggerClientEvent("onCreation",source,source) 
        sql.Query("INSERT INTO jugadores (Name, columnAccount) VALUES ('d','"..username.."')") -- Here is the problem 
        sql.Query("INSERT INTO cordes (ID, columnX, columnY, columnZ) VALUES ('"..username.."','','','')") 
       end 
   end 
end 

Problem :

--No column named Name 

Link to comment
addEventHandler( "onResourceStart",resourceRoot, 
    function( ) 
        executeSQLQuery( "CREATE TABLE IF NOT EXISTS jugadores ( Name TEXT,columnAccount TEXT )" ) 
        executeSQLQuery( "CREATE TABLE IF NOT EXISTS cordes ( ID STRING,columnX FLOAT,columnY FLOAT,columnZ FLOAT )" ) 
    end 
)    
  
function creacio( _,account ) 
    local username = getAccountName( account ) 
    if account then 
        local data = getAccountData( account,"LARP.player" ) 
        if not data then 
            showCursor( source,true ) 
            triggerClientEvent( "onCreation",source,source ) 
            executeSQLQuery( "INSERT INTO jugadores VALUES ('','"..username.."')" 
            executeSQLQuery( "INSERT INTO cordes VALUES ('"..username.."','','','')" ) 
        end 
    end 
end 
addEventHandler( 'onPlayerLogin',root,creacio ) 

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