SA-MP Forums Archive
not inserting id in the database - 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: not inserting id in the database (/showthread.php?tid=664421)



not inserting id in the database - bosmania - 28.02.2019

mysql_format(mysql, szQuery, 256, "INSERT INTO `clans` (`Name`) VALUES ('%e')", inputtext);
new Cache: result = mysql_query(mysql, szQuery);
new i = cache_insert_id();
cache_delete(result);
PlayerInfo[playerid][pClanid] = i;
this is not inserting a new clan id in the database,i create a clan for the first time and it creates a clan id 0 in the database and that's it,if i try to create anotherone the data base only has the first one;


Re: not inserting id in the database - bosmania - 28.02.2019

you mean this?
new Cache: result = mysql_tquery(mysql, szQuery);
im new into scripting so please have patience with me


Re: not inserting id in the database - raydx - 28.02.2019

Setup auto increment/primary key for id.


Re: not inserting id in the database - bosmania - 28.02.2019

i've set primaty key for id and it's still not working and auto increament i don;t know how to do that


Re: not inserting id in the database - naahu - 28.02.2019

Quote:
Originally Posted by bosmania
Посмотреть сообщение
i've set primaty key for id and it's still not working and auto increament i don;t know how to do that
Edit your table structure and set A_I (Auto Increment).