I wrote a map vote plugin that works great on my server using a local MySQL database. People posted that it would create the table for them, but that the results would not get added to the database. I used an external database from a website to test the plugin and I am getting the same results as they are. It creates the database and when the vote is it done, I am getting the "[AMXX] sql_mapvote results added to database" added to the logs, but the data is not added to the database. It is only happening on remote databases. Is there something I can do to make this work?
Code:
public sql_insert() {
if (dbc == SQL_FAILED) return PLUGIN_CONTINUE
new mapname[33]
get_mapname(mapname,32)
new totalint
totalint = floatround(total)
//Insert map information into the tables
result = dbi_query(dbc,"INSERT INTO maprank2 (map_name, good, okay, bad, total) values ('%s',%i,%i,%i,%i) ON DUPLICATE KEY UPDATE map_name=map_name, good=good+%i, okay=okay+%i, bad=bad+%i, total=total+%i",mapname,state[0],state[1],state[2],totalint,state[0],state[1],state[2],totalint)
if (result < RESULT_NONE) {
new err[255]
new errNum = dbi_error(dbc, err, 254)
log_amx("[AMXX] sql_mapvote error: %s|%d", err, errNum)
server_print("[AMXX] sql_mapvote error: %s|%d", err, errNum)
return 1
}else{
log_amx("[AMXX] sql_mapvote results added to database")
}
dbi_free_result(result)
return PLUGIN_CONTINUE
}