I have LuaPower and using your MySQL, however, it can't seems to get all thing working fine.
Now, I have successfully made a connection and I am also able to select tables for example, but I was unable to insert any data into the tables.
The error itself is: FATAL ERROR [UNHANDLED EXCEPTION]: Attempt to call uninitialized function pointer
Here is my LUA code, so you can understand what I am trying to do:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
addhook("join", "onJoin")
addhook("minute", "saveStats")
addhook("say", "logChat")
addhook("say","onSay")
local mysql = require'mysql'
-- MySQL Connection Details:
sql_host = "localhost" -- Host
sql_user = "root" -- USER
sql_password = "1c%CIuROpD17" --Pass
sql_db_name = "cs2d" -- DBNAME
sql_port = 3306
local con = mysql.connect(sql_host, sql_user, sql_password, sql_db_name, 'utf8')
function onJoin(id)
local usgn = player(id, "usgn")
local ip = player(id, "ip")
local name = player(id, "name")
local datime = os.date("%c")
if usgn > 0 then
-- con:query("INSERT INTO `logins`(`col_int`,`col_varchar`,`col_varchar`,`col_varchar`,`col_datetime`) VALUES (usgn, ip, name, datime)")
print("a")
msg("new player joined!")
elseif usgn == 0 then
-- con:query("INSERT INTO `logins`(`col_int`,`col_varchar`,`col_varchar`) VALUES (name, datime)")
end
end
Unfortunately the query seems to be incorrect format or at least no real clue on which way could I make this happen.
I can't seems to debug it further. But I believe must be related the way I am trying to make the query, as for example selecting tables works with with the same connection.
Update: it's the issue of the MySQL library that generates a Windows generic error.
edited 1×, last 17.11.19 03:39:23 pm