SA-MP Forums Archive
SQL ( (error #1062) Duplicata du champ '0' pour la clef '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: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') (/showthread.php?tid=582578)



SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - STONEGOLD - 21.07.2015

PHP код:
[23:27:30] [DEBUGCMySQLResult::~CMySQLResult() - deconstructor called
[23:27:39] [DEBUGmysql_tquery connection1query"INSERT INTO `clothes` (holder, model, bone, offestx, offesty, of"callback"OnFinishPurchase"format"id"
[23:27:39] [DEBUGCMySQLQuery::Execute[OnFinishPurchase] - starting query execution
[23:27:39] [ERRORCMySQLQuery::Execute[OnFinishPurchase] - (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY'
[23:27:39] [DEBUGCMySQLQuery::Execute[OnFinishPurchase] - error will be triggered in OnQueryError 



Re: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - Beckett - 21.07.2015

Can you show us your clothes table?


Re: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - STONEGOLD - 21.07.2015





Re: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - DanishHaq - 21.07.2015

Give us the action from the code that corresponds to that query.


Re: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - STONEGOLD - 21.07.2015

PHP код:
stock OnBuyClothes(playeridindexmodelboneFloat:fOffsetXFloat:fOffsetYFloat:fOffsetZFloat:fRotXFloat:fRotYFloat:fRotZFloat:fScaleXFloat:fScaleYFloat:fScaleZ)
{
    
format(querysizeof(query), "INSERT INTO `clothes` (holder, model, bone, offestx, offesty, offestz, rotx, roty, rotz, scalex, scaley, scalez) VALUES ('%s', %d, %d, %f, %f, %f, %f, %f, %f, %f, %f, %f)",
    
GetName(playerid), modelbonefOffsetXfOffsetYfOffsetZfRotXfRotYfRotZfScaleXfScaleYfScaleZ);
    
mysql_function_query(1querytrue"OnFinishPurchase""id"playeridindex);
}
forward OnFinishPurchase(playeridindex);
public 
OnFinishPurchase(playeridindex)
{
    
ClothesInfo[playerid][index][cID] = cache_insert_id(1);
    return 
1;

This?


AW: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - Macronix - 21.07.2015

Is "id" set to AUTO_INCREMENT?


Re: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - STONEGOLD - 21.07.2015

how can i set it as AUTO_INCREMENT? i can't find it.


AW: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - Macronix - 21.07.2015

You need to go on "Change" under "Structure" (row "id") and tick the "A_I" box.


Re: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - StuartD - 21.07.2015

>

Do that.


Re: SQL ( (error #1062) Duplicata du champ '0' pour la clef 'PRIMARY') - STONEGOLD - 21.07.2015

Anyways, its fixed thanks guyz.