Hello,
i use tmysql to connect to a database, and get a list of players.
I use select BLABLA from blabla... but everytime i get Nil exempt a Table.
My Code:
[CODE]
local table, success, error = tmysql.query( "SELECT steamid FROM members" )
for key,value in ipairs(table) do
local cell = key
local row = value
Msg("--> "..cell..": "..row)
end
[/CODE]
when i try
[CODE]
local ismember = tmysql.query( "SELECT steamid FROM members WHERE steamid = '"..SteamID.."'" );
PrintTable(ismember)[/CODE]
It doesn't return anything.
There is a entry in the Database, and i am connected (i can insert things).
Could someone please help me? :)
It doesnt have the information straight away, i sugest making use of the callback system :)
How you mean that? :)
I am very new to Lua :)
I think you're supposed to use tmysql like this
[lua]
tmysql.query("query here", function(result, status, err)
end)
[/lua]
hmm, i will try
Edit: looks a bit better...
But now result is a boolean :P
But i want the Value of "name"
SELECT name FROM ?
Its not about what stands in the mysql command :D It's how I can get the "Value" of name? ^^ return just returns an Boolean
tmysql.Query calls a callback with this parameter ( among others that I cba to look for ) : MyFunc( data ) end
Data is a table. To access data inside of it , you would loop through it. Think of it this way :
Data[ ROW ][ COLUM ]
colum will be a number , not a string.
Sorry, you need to Log In to post a reply to this thread.