Jump to content

SQlite table error


Solstice.

Recommended Posts

I thought the issue was with dbConnect initially although after going through some checkpoints there appears to be an issue table-side.

function display_char () 
    db = dbConnect ("sqlite", "account_info.db") 
    outputChatBox ("Some generic output implying the function is triggered") 
    if db == false then 
        outputChatBox ( "Some generic output implying dbConnect doesn't work") 
    else 
        outputChatBox ("Some generic output implying dbConnect does work") 
        skin_id = executeSQLQuery ("SELECT skin FROM characters WHERE acc_owner=? AND slot=?", acc_name, 1) 
        outputChatBox ( "",skin_id,"") -- if there's no output there's probably an issue with the query 
    end 
end 

1C4d6

Link to comment
For using executeSQLQuery, the working database is the one stored as registry.db.

If you want to use your own DB, you gotta use dbExec

Although dbExec only returns true or false. What I need is to have the query return the skin ID listed in the table for the respective character.

An example:

1C5Ek

How do I go about pulling the number '121' from the table so I can use it to set a spawned player's skin? Basically bind 121 to a variable. I'm working on a system whereas you can have more characters bound to one account. Later I'll be adding additional collums such as money in hand etc. but to get the drill I'm starting off simple.

Link to comment

For that you can use dbQuery and then use dbPoll on that dbQuery.

local ex = dbQuery(...) 
local poll = dbPoll(ex, -1) 

Poll will be the table holding all the tables from the query

so if you wanna get that using:

SELECT skin FROM yourtable WHERE acc_owner = 'solstice' 

It will be stored in poll[1].skin if I'm not wrong.

Link to comment
For that you can use dbQuery and then use dbPoll on that dbQuery.
local ex = dbQuery(...) 
local poll = dbPoll(ex, -1) 

Poll will be the table holding all the tables from the query

so if you wanna get that using:

SELECT skin FROM yourtable WHERE acc_owner = 'solstice' 

It will be stored in poll[1].skin if I'm not wrong.

Perfect! Thank you very much. That helped me out.

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