Deucalion 249 Posted April 26, 2014 Share Posted April 26, 2014 Hi. Maybe it's easy but, i have problem with that ;/ I have a MySQL 5.6 and Vanilla core 2.3 with db. When I use a game.mysql_query in quest with "SELECT", and put it into chat I have a empty chat, and nothing in sysser, but when I put query into e.g "chat("something"..query.." ") i have this error in sysser: SYSERR: Apr 26 11:31:02 :: RunState: LUA_ERROR: [string "test_quest"]:3: attempt to concatenate local `query' (a table value) SYSERR: Apr 26 11:31:02 :: WriteRunningStateToSyserr: LUA_ERROR: quest test_quest.start click Part of e.g quest local query = game.mysql_query('SELECT name FROM player.player WHERE id = 70984') chat("something"..query.." ") But when I use this query in navicat everything is ok. I'll be grateful for the help Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted April 26, 2014 Share Posted April 26, 2014 try chat("something"..query.name[1].." ") https://m2admin.net/ Link to comment Share on other sites More sharing options...
Deucalion 249 Posted April 26, 2014 Author Share Posted April 26, 2014 now error is a little bit different SYSERR: Apr 26 12:38:37 :: RunState: LUA_ERROR: [string "test_quest"]:3: attempt to index field `name' (a string value) SYSERR: Apr 26 12:38:37 :: WriteRunningStateToSyserr: LUA_ERROR: quest test_quest.start click Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted April 26, 2014 Share Posted April 26, 2014 try now chat(tostring(query.name[1])) https://m2admin.net/ Link to comment Share on other sites More sharing options...
Deucalion 249 Posted April 26, 2014 Author Share Posted April 26, 2014 Still the same error, when i use only chat(tostring(query)), on chat i have "table: 0x44f09f20". It's looks like my query give me back a table ;o Link to comment Share on other sites More sharing options...
Aveline™ 554 Posted April 26, 2014 Share Posted April 26, 2014 local query = game.mysql_query("select name from player.player where id = '700984'") if(table.getn(query) == 0) then return chat("There nothing.. ") else chat(query[1]) end Test it like this Kind Regards HaveBeen 1 Plain logic saves lives. Link to comment Share on other sites More sharing options...
Deucalion 249 Posted April 26, 2014 Author Share Posted April 26, 2014 Now quest return empty chat Link to comment Share on other sites More sharing options...
Aveline™ 554 Posted April 26, 2014 Share Posted April 26, 2014 Now quest return empty chat You're sure this query is truth? Kind Regards HaveBeen Plain logic saves lives. Link to comment Share on other sites More sharing options...
lolor2 73 Posted April 26, 2014 Share Posted April 26, 2014 Now quest return empty chat You're sure this query is truth? Kind Regards HaveBeen right* @HaveBeen: Wahr/Nicht Wahr = true(truth) /false, Richtig/Falsch = right/wrong best regards Xunil Link to comment Share on other sites More sharing options...
Deucalion 249 Posted April 26, 2014 Author Share Posted April 26, 2014 Yes I'm sure, i tried another query to another mysql table and still the same ;/ I've tried this query in navicat and it's work perfectly Link to comment Share on other sites More sharing options...
Deucalion 249 Posted April 29, 2014 Author Share Posted April 29, 2014 I have still problem with that, so can anybody help me with this? Sent from my ST25i using Tapatalk Link to comment Share on other sites More sharing options...
Endymion 319 Posted April 29, 2014 Share Posted April 29, 2014 Try use query[1][1] 2 Link to comment Share on other sites More sharing options...
Solution Great 16 Posted April 29, 2014 Solution Share Posted April 29, 2014 In mysql result you have 2x table chat("something"..query[1][1].." ") 2 Link to comment Share on other sites More sharing options...
Deucalion 249 Posted April 29, 2014 Author Share Posted April 29, 2014 Now everything working, thank you Link to comment Share on other sites More sharing options...
Mijago 4 Posted April 30, 2014 Share Posted April 30, 2014 I prefer to set a test whether the variable exists. If your query fails, the table is empty, or in the worst case, nil. So you can test it with an if statement like that : if query and query[1] then -- or if (query or {}) [1] then -- or chat('sth '.. ((query or {{0}})[1] or {0})[1}) the latest is pro code, you don't need to understand it, but if you do, Nice With those statements you prevent syserr messages Sent by Tapatalk @ Galaxy Note 10.1 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now