2x Sql Problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 2x Sql Problem (
/showthread.php?tid=640909)
2x Sql Problem -
Develerux - 08.09.2017
PHP код:
if(Local[playerid][jegyezve]) {
mysql_format(Sql, query, sizeof(query), "IF EXISTS (SELECT * FROM `jegyezve` WHERE `username` = '%e') BEGIN UPDATE `jegyezve` SET `IP`='%e' WHERE `username` = '%e' END ELSE BEGIN INSERT INTO `jegyezve` (`username`, `IP`) VALUES ('%e', '%e') END", Account[playerid][ausername], Account[playerid][IP], Account[playerid][ausername], Account[playerid][ausername], Account[playerid][IP]);
mysql_tquery(Sql, query, query);
} else {
mysql_format(Sql, query, sizeof(query), "IF EXISTS (SELECT * FROM `jegyezve` WHERE `username` = '%e') BEGIN DELETE FROM `jegyezve` WHERE `username` = '%e' END", Account[playerid][ausername], Account[playerid][ausername]);
mysql_tquery(Sql, query, query);
}
At the same error 2 query.
PHP код:
[log-core] exception 0XC0000005 (ACCESS_VIOLATION) from Vectored Exception Handler catched; shutting log-core down
Re: 2x Sql Problem -
Vince - 08.09.2017
No idea what's causing that but look up ON DUPLICATE KEY UPDATE. Also you should use unique IDs for querying.
Re: 2x Sql Problem -
Develerux - 09.09.2017
At the same error with this:
PHP код:
mysql_format(Sql, query, sizeof(query), "INSERT INTO `jegyezve` (`username`, `IP`) VALUES ('%e', '%e') ON DUPLICATE KEY UPDATE `jegyezve` SET `IP`='%e' WHERE `username` = '%e'", Account[playerid][ausername], Account[playerid][IP], Account[playerid][IP], Account[playerid][ausername]);
Primary key is username
Mabye problem with database type? I use InnoDB
Re: 2x Sql Problem -
Develerux - 09.09.2017
Solved!