Jump to content

Table in SQL


undefined

Recommended Posts

Hi guys. I'm new on SQL. I am begin to write save system. But i have a problem

local money, skin, armor, stats = 500, 286, 100, {{24,569}, {69,0},{70,0},{71,0},{72,0},{73,0},{74,0},{75,0},{76,0},{77,0},{78,0},{79,0}} 
executeSQLCreateTable("playersData", "account_name TEXT, money INTEGER, skin INTEGER, armor INTEGER, stats INTEGER") 
executeSQLQuery("INSERT INTO playersData(account_name,money,skin,armor,stats) VALUES(?,?,?,?,?)", tostring(account_name),money,skin,armor,stats) 

I'm do this but when I use this,

outputChatBox(executeSQLQuery("SELECT stats FROM playersData WHERE account_name=?", tostring(account_name))[1].stats) 

this saying 100. But it must be table. Why number -,-

Help me :cry:

Link to comment
You created a table with stats as integer. Even if you try to save a table, it will still be integer. You can use string as table type and save tables with toJSON - read further with fromJSON.

I did your said. But it's not work.

My all code.

Code Removed 

n5NPl0.png

Server Said:

[ [ [ 24, 569 ], [ 69, 0 ], [ 70, 0 ], [ 71, 0 ], [ 72, 0 ], [ 73, 0 ], [ 74, 0 ], [ 75, 0 ], [ 76, 0 ], [ 77, 0 ], [ 78, 0 ], [ 79, 0 ] ] ] 

It's a string. But I need table. :(

Edited by Guest
Link to comment

OK. I removed this code. Now,

  
outputChatBox(tostring(#getAccountStats(account))) -- said - 1 
outputChatBox(tostring(#getAccountStats(account)[1])) -- said - 0 
outputChatBox(tostring(getAccountStats(account)[1])) -- said - table: 05764310 
outputChatBox(tostring(getAccountStats(account)[1].stats)) -- said - 100 
  

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