SA-MP Forums Archive
Mysql help - 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: Mysql help (/showthread.php?tid=279324)



Mysql help - FireCat - 26.08.2011

Like I want to select the AccID i have in my mysql table.
It's as auto_increment but im not sure how to get there.
My code:
pawn Код:
if(dialogid == Regdialog2)//Inputting password dialog
    {
        new string[200],tempquery[100],PlayerAccID;
        if(strlen(inputtext) == 0)
        {
            ShowPlayerDialog(playerid,Regdialog2,DIALOG_STYLE_INPUT,""cblue"Register - "cyellow"Enter your password",""cblue"You are about to register a "cyellow"new account"cblue"! \nPlease choose the "corange"password"cblue" for it! \n","Register!","");
            SendClientMessage(playerid,red,"Please input a password!");
        }
        else
        {
            format(Query,sizeof(Query),"INSERT INTO `Users` (Username,Password) VALUES ('%s','%s')",GetPName(playerid),inputtext);
            mysql_query(Query);
            format(tempquery,sizeof(tempquery),"SELECT * FROM `Users` WHERE `Username` = '%s' AND `AccID` = '%i'",GetPName(playerid),PlayerAccID);
            mysql_query(tempquery);
            mysql_store_result();
            SendClientMessage(playerid,green2,"You have been successfully registered!");
            format(string,sizeof(string),""cgreen"You have been successfully registered! \n"cwhite"» Your username: "cblue"%s \n"cwhite"» Your password: "cblue"%s \n"cwhite"» Your account ID: "cblue"%i",GetPName(playerid),inputtext,PlayerAccID);
            ShowPlayerDialog(playerid,Reginfo,0,"Registered!",string,"Ok","");
            mysql_free_result();
        }
    }



Re: Mysql help - array13 - 26.08.2011

this post will have a nice day xD


Re: Mysql help - Lenny the Cup - 26.08.2011

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