MYSQL mysql_insert_id
#1

for some reason mysql insert id does not work but it carrys out the query and i have a colum in mysql table named id and an AUTO_INCREMENT on it

Код:
mysql_function_query(mysql, szDestination, false, "", "");
printf("account registered with ID %d", mysql_insert_id(mysql));
mysql_free_result(mysql);
Reply
#2

it only works if your last query was INSERT

https://sampwiki.blast.hk/wiki/MySQL#mysql_insert_id
Reply
#3

my last query was insert

here the mysql log
Код:
[14:53:51] ProcessQueryThread() - Query was successful. (INSERT INTO `users`(`pName`, `pPassword`, `pCash`, `pAcccount`, `pAdmin`, `pRank`, `pJRank`, `pJob`, `pLevel`, `pExp`, `gPupgrade`, `pKills`, `pCB`, `pHW`, `pSR`, `pSP`, `pDB`, `pFUG`, `pGun1`, `pGun2`, `pGun3`, `pGun4`, `pGun5`, `pGun6`, `pGun7`, `pGun8`, `pAmmo1`, `pAmmo2`, `pAmmo3`, `pAmmo4`, `pAmmo5`, `pAmmo6`, `pAmmo7`, `pAmmo8`,`pSHealth`, `pHealth`, `pPos_x`, `pPos_y`, `pPos_z`, `pInt`, `pLocal`, `pTeam`, `pModel`, `pPnumber`, `pPhousekey`, `pPbiskey`, `pDuty`, `pContract`, `pTick`, `pWarnL`, `pSArmour`, `pKillz`, `pCBz`, `pHWz`, `pSRz`, `pWAz`, `pPENz`, `pDeathz`, `pDMz`, `pLICc`, `pLICp`, `pLICb`, `pLICh`, `pRoadblock`, `pAdminX`, `pHealthinsur`, `pCarinsur`, `pHouseinsur`, `pJizzy`, `pPass`, `pAllkills`, `pBeslag`,`pInt2`, `pLocal2`, `pPhousekey2`, `pSpawn`, `pArrest`, `pTicket`, `pAWarn`, `pReasall`, `pReas1`, `pReas2`, `pReas3`, `pBShow`) VALUES ('[SFP]Ltzboy.hc','****',10000,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,200,8,30,30,10,10,5,1,0,1112014848,-1914.400024,876.799988,35.400002,0,255,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0);)
[14:53:51] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick()
Reply
#4

this works for me
pawn Код:
mysql_function_query(server,"INSERT INTO .......",true,"GetID","");

forward GetID();
public GetID()
{
      printf("%d",mysql_insert_id(server));
      return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)