How to make a return using os.execute?

10/04/2014 18:30 stσям™#1
Hi, How do i make this return

function getcoins()
os.execute("mysql -u root player --execute='SELECT coins FROM player WHERE id = "..pc.get_player_id()..";'")
end

Like this:

local a = mysql_query("SELECT coins from player.player WHERE id="..pc.get_account_id().." LIMIT 1;")[1][1]
a = tonumber(a)
return a

(im using os.execute because i'm getting a error when i use mysql_query)
10/04/2014 20:06 .HC'Destrox#2
you have to write the result of the query in a file through the shell command "mysql" with "mysql [...] --execute='[..]' > filename.txt" and then read the file and remove the file