Adding values starting from 0001
#1

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
Reply
#2

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.
Reply
#3

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)