Jump to content

SQLite Problem! [Solved]


undefined

Recommended Posts

Posted (edited)

Hi guys. Im work on my save system. But I have a problem.

I get this error:

ERROR: mas\DB\hud_option.lua:29: Database query failed: no such table: hud_option 
ERROR: mas\DB\hud_option.lua:29: attempt to index field '?' (a nil value) 

Here is my DB:(Empty)

VAvgkq.png

And here is my code:

Code Removed 

Help pls... :cry:

Edited by Guest
Posted (edited)

Here is my new code:

Code Removed 

And Error:

ERROR: mas\DB\hud_option.lua:43: attempt to index a userdata value 

Edited by Guest
Posted

It's return the result of the query. Also for update and insert use dbExec because there's no result will be returned.

CiTLh.png
Posted
local query = dbQuery(connectDB, "SELECT hudColor FROM hud_option WHERE account_name=?", tostring(account_name))[1].hudColor -- Line 42 
local result = dbPoll(query, -1) 
if result then 
    return fromJSON(query) 
end 

I'm make this but it's not work! :cry:

ERROR: mas\DB\hud_option.lua:42: attempt to index a userdata value

Posted
local query = dbQuery(connectDB, "SELECT hudColor FROM hud_option WHERE account_name=?", tostring(account_name)) 
local result = dbPoll(query, -1) 
if result then 
    return result 
end 

And the close bracket at line 1 is missing.

Where? I can't see. Can you show me?

Posted
local query = dbQuery(connectDB, "SELECT hudColor FROM hud_option WHERE account_name=?", tostring(account_name)) 
local result = dbPoll(query, -1) 
if result then 
    return result 
end 

And the close bracket at line 1 is missing.

Where? I can't see. Can you show me?

Nothing in this code, have you tried it?

CiTLh.png
Posted (edited)

Yes, I tried it. It's not give error or warning. And it's not work. The result table is empyt.

Here is my new all code:

Code Removed 

Edited by Guest
Posted (edited)

@Wassim

I already solved this problem. But thank you nevertheless.

Code Removed 

OK. I understand now . Now, return is not work. Look at the line 11

It must say; [ [ true, true, true, true, false, 255, 190, true, true ] ]

But it say; [ [ { "hudOption": false } ] ]

Where is the problem?

Edit:
return dbPoll(dbQuery(connectDB, "SELECT hudOption FROM hud_option WHERE account_name=?", tostring(account_name)), -1)[1].hudOption-- Line 63 

outputChatBox said: [ false ]

Edited by Guest

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