Veteran Member
Join Date: Nov 2014
Location: Lithuania
|
08-07-2017
, 02:18
MySql saving failure
|
#1
|
hello, I need a little help on how to save data in mysql. My most recent try was this:
Spoiler
PHP Code:
public client_disconnect(id) {
MySql_save_player_data(id)
MySql_save_player_skins(id)
}
public MySql_save_player_skins(id) {
new temp[512]
for(new i=0; i<gun_count; i++) {
console_print(0, "%i", i)
format(temp,charsmax(temp), "UPDATE `csgo_player_weapons` SET `active` = '%i', `count` = '%i' WHERE `csgo_player_weapons`.`player_id` = '%i', `skin_id` = '%i'", equiped[id][i], player_weapons[id][i], ID[id], skin_id[i])
console_print(0, "%i", skin_id[i])
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",temp)
}
return PLUGIN_HANDLED
}
public MySql_save_player_data(id) {
new temp[512]
format(chests[id], 24, "%i %i %i %i", cases[id][0], cases[id][1], cases[id][2], cases[id][3])
switch(login_type[id]) {
case 0: get_user_authid(id, login_data[id], charsmax(login_data[]))
case 1: get_user_ip(id, login_data[id], charsmax(login_data[]), 1)
case 2: get_user_name(id, login_data[id], charsmax(login_data[]))
}
console_print(0, "update 0")
format(temp,charsmax(temp),"UPDATE `csgo_players` SET `chests` = '%s', `keys` = '%i', `points` = '%i', `kills` = '%i', `player_id` = '%s', `player_password` = '%s' WHERE `csgo_players`.`ID` = '%i';", chests[id], keys[id], points[id], kills[id], login_data[id], (login_type[id] == 2) ? password[id] : "", ID[id])
console_print(0, "update 1")
SQL_ThreadQuery(g_SqlTuple,"IgnoreHandle",temp)
return PLUGIN_HANDLED
}
public IgnoreHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize) {
SQL_FreeHandle(Query)
return PLUGIN_HANDLED
}
I have tried priting all the values to the console and they are right, but data doesnt get saved. any ideas?
had to switch to new host and fixed smh
__________________
retired chump
Last edited by DjSoftero; 08-10-2017 at 05:54.
|
|