Hik 108 Posted January 6, 2016 Share Posted January 6, 2016 Hi guys. I have this script : local kill = mysql.query("SELECT p_kill FROM account.account WHERE id = (SELECT account_id FROM player.player WHERE name='"..pc.get_name().."');")[1][1] notice_all("Punti ottenuti: "..kill.."") When I run the script I get this error : attempt to concatenate global 'kill' (a nil value) . I created the table p_kill and I can run with success the query: mysql.query("UPDATE account.account SET p_kill = p_kill + 1 WHERE id = (SELECT account_id FROM player.player WHERE name='"..pc.get_name().."');") What's the matter? Sorry for my bad english. Link to comment Share on other sites More sharing options...
Hik 108 Posted January 7, 2016 Author Share Posted January 7, 2016 up Link to comment Share on other sites More sharing options...
DarkAng3l 25 Posted January 7, 2016 Share Posted January 7, 2016 mysql_query("SELECT p_kill FROM account.account WHERE id = '"..pc.get_account_id().."'") Use function pc.get_account_id() Link to comment Share on other sites More sharing options...
Hik 108 Posted January 7, 2016 Author Share Posted January 7, 2016 attempt to call global 'mysql_query'(a nil value) Link to comment Share on other sites More sharing options...
DarkAng3l 25 Posted January 7, 2016 Share Posted January 7, 2016 You write mysql.query, I write mysql_query, I don't know which functions you have in your quest_functions or game file. Link to comment Share on other sites More sharing options...
Hik 108 Posted January 7, 2016 Author Share Posted January 7, 2016 Sorry, my error. I tried so (i have mysql.query | mysql.direct_query | mysql.update | mysql.real_escape_string | mysql.get_table_postfix in quest_function): local kill = mysql.query("SELECT p_kill FROM account.account WHERE id = '"..pc.get_account_id().."'") but I get: attempt to concatenate local 'kill' (a table value) Link to comment Share on other sites More sharing options...
DarkAng3l 25 Posted January 7, 2016 Share Posted January 7, 2016 If you use game functions, use this local c, kill = mysql.direct_query("SELECT p_kill FROM account.account WHERE id = '"..pc.get_account_id().."'") if c != 0 then notice_all(kill[1].p_kill) end 1 Link to comment Share on other sites More sharing options...
Hik 108 Posted January 7, 2016 Author Share Posted January 7, 2016 Work! Thanks! I replace : notice_all(kill[1].p_kill) with notice_all(""..kill[1].p_kill.."") . Could you explain what the error was due? 1 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