Jump to content

SQLite help


Zonex Favel

Recommended Posts

My first question is does the database get completely written over when you create a new table, and do all the values get erased?

I'm also having trouble with using the executeSQLQuery function.

Table

  
executeSQLCreateTable("Players","player_id TEXT, player_username TEXT, player_password TEXT") 
  

functions not working

  
function registerPlayer(playerName, pass) 
    [b]regSuccess = executeSQLQuery("INSERT INTO Players VALUES ('001',?,?)", playerName, pass)[/b] 
    if(regSuccess) then 
        outputChatBox("Registration Success") 
    end 
    [b]player = executeSQLQuery("SELECT player_password FROM Players WHERE player_username='gamemode'")[/b] 
end 
  

The first one gives me

Error: Database query failed: unrecognized token: "\"
then the first line.

The second one gives me

Error: Database query failed: near "symbols" syntax error
then the second line.

Thanks for the help in advance everyone

Link to comment

  
function makeTables() 
    executeSQLCreateTable("locations", "location_name TEXT, location_pos TEXT") 
  
    doInsertQ = executeSQLQuery("INSERT INTO locations VALUES ('origin', 'x=0y=0z=0')") 
    if(doInsertQ) then 
        outputConsole("insert Query successful") 
    end 
  
    doInsertE = executeSQLInsert("locations", "'origin', 'x=0y=0z=0'") 
    if(doInsertE) then 
        outputConsole("easy insert Query successful") 
    end 
  
    doSelectQ = executeSQLQuery("SELECT location_pos FROM locations WHERE location_name = 'origin'") 
    if(doSelectQ) then 
        outputConsole("select Query successful") 
    end 
  
    doSelectE = executeSQLSelect("locations", "location_pos", "location_name ='origin'") 
    if(doSelectE) then 
        outputConsole("easy select Query successful") 
    end 
  
end 
  
addEventHandler( "onResourceStart", getResourceRootElement(getThisResource()),makeTables) 
  

I get these errors from the SQLQuery functions, the other two seem to work fine. They don't do an output message but they don't give me any errors.

ERROR: Database query failed: near "X(symbol)": sytanx error (INSERT INTO locations VALUES ('origin', 'x=0y=0z=0'))

ERROR: Database query failed: near "T": syntax error (SELECT location_pos FROM locations WHERE location_name = 'origin')

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