Adding values starting from 0001 - 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: Adding values starting from 0001 (
/showthread.php?tid=416253)
Adding values starting from 0001 -
Neil. - 16.02.2013
Already started and got stuck here:
pawn Код:
if(dialogid == 23)
{
if(response)
{
switch(listitem)
{
case 0:
{
//new Year, Month, Day;
//getdate(Year, Month, Day);
//new dateform[100];
//format(dateform,sizeof(dateform), "%02d/%02d/%d", Day, Month, Year);
new form2[30];
format(form2,sizeof(form2), "No Transaction");
new bankquery[300];
format(bankquery, sizeof(bankquery), "INSERT INTO `pinfo` (`id`, `name`, `money`, `latesttransaction`) VALUES ('%d', '%s', 0, '%s')", /*????????*/ , escpname(playerid), form2);
I want to insert a value in the 'id' wherein it starts 0001. After which it then proceeds to 0002 so on and so forth. Also, if there is a deleted player how can I 'fill' a number in? For example if ID 0002 will be deleted, the next player who'll register will get that special ID instead of 0003.
I'm guessing I have to loop through all of the rows in the table to find the empty slot in which to be filled in. Could anyone show me about how would I be going to do that?
Cheers to anyone who's willing to help
Re: Adding values starting from 0001 -
Vince - 16.02.2013
What is the point of filling in the blank spots? Does the player get to see his special ID? I think not. Use auto_increment.
Re: Adding values starting from 0001 -
Neil. - 16.02.2013
Quote:
Originally Posted by Vince
What is the point of filling in the blank spots? Does the player get to see his special ID? I think not. Use auto_increment.
|
It's supposed to be filling in the blank spots because I need them to, another table of the database make use of those unique identifications. Anyhow, Could you cite an example of how would I apply the auto_increment starting at 0001?