SA-MP Forums Archive
Duplicate entry '91' for key 'PRIMARY'" - 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: Duplicate entry '91' for key 'PRIMARY'" (/showthread.php?tid=584562)



Duplicate entry '91' for key 'PRIMARY'" - Metharon - 05.08.2015

I'm having 100 players + online on server, the problem is i'm getting this errors constantly:


- Log("01:24:59","CMySQLQuery::Execute[]",1,"(error #1062) Duplicate entry '90' for key 'PRIMARY'",1);
Log("01:25:12","CMySQLQuery::Execute[]",1,"(error #1062) Duplicate entry '91' for key 'PRIMARY'",1);
Log("01:31:23","CMySQLQuery::Execute[]",1,"(error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' WHERE id = 431' at line 1",1);
Log("01:33:09","CMySQLQuery::Execute[]",1,"(error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1",1);

From register , and loading i'm getting 'unkown where clause ' * player name * '

the functions i'm using is


//Login
mysql, query, sizeof(query), "SELECT * FROM `players` WHERE `Name` = '%e' LIMIT 1", GetName(playerid));
mysql_tquery(mysql, query, "OnAccountLoad", "i", playerid);

pawn Код:
forward OnAccountLoad(playerid);
public OnAccountLoad(playerid)
{
    StopAudioStreamForPlayer(playerid);
    IsSpawnedServer[playerid] = 1;
    PlayerInfo[playerid][pMysqlID] = cache_get_field_content_int(0, "id");
    PlayerInfo[playerid][pLevel] =  cache_get_field_content_int(0, "PlayerLevel");
    PlayerInfo[playerid][fActivity] =   cache_get_field_content_int(0, "FactionActivity");
    PlayerInfo[playerid][pHaveCard] =   cache_get_field_content_int(0, "HaveCard");



Registering :



mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` ( `Name`, `Password`, `Tutorial`) VALUES ('%e', '%e', 0)", GetName(playerid), inputtext);
mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
}


pawn Код:
public OnAccountRegister(playerid)
{
    PlayerInfo[playerid][pMysqlID] = cache_insert_id();
    PlayerInfo[playerid][pLevel] = 1;
    PlayerInfo[playerid][pLockedDays] = 0;
Tell me , how can i fix it


Re: Duplicate entry '91' for key 'PRIMARY'" - StuartD - 05.08.2015

Do you have access to the database controller like phpMyAdmin? Show the structure of the players table.


Re: Duplicate entry '91' for key 'PRIMARY'" - Metharon - 06.08.2015