• tMySQL using query return values
    2 replies, posted
Simple enough, I'm trying to convert the first result in the result table from a query into a usable variable. When you run a query, it runs the following function (Which is the callback), when I use PrintTable() it prints the query result just fine, but if I use a for loop to print the index followed by its value, it returns me the table's identifier number. If I try using result[1] or result["name"], it just returns nil. [lua]function CheckForSQL(result, status, error) print("Checking for SQL..") print("Status: "..status) print("Error: "..error) PrintTable(result) for k,v in pairs(result) do print(k,v) end end[/lua] Returns: [quote]Checking for SQL... Status: 1 Error: 0 1: name = kopimi<3 1 table: 022AA050 [/quote] What I want to do is say something like: [lua]print(result[1])[/lua] And have it output: [quote]kopimi<3[/quote] Or at least some usable form of data. How can I accomplish this? I really need to get this working. I'm using tMySQL, latest revision, I've got it all installed right and yadda yadda, just cant return a usable data type. Thanks in advance.
print(result.name) ?
[QUOTE=CombineGuru;23560253]print(result.name) ?[/QUOTE] [lua]print(result[1]["name"])[/lua] :smug:
Sorry, you need to Log In to post a reply to this thread.