SA-MP Forums Archive
[DUV] Saving In MySql (/email) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [DUV] Saving In MySql (/email) (/showthread.php?tid=150481)



[DUV] Saving In MySql (/email) - ipsBruno - 26.05.2010

I have this command to save the emails in email.txt, was wondering how do I save in MySql (Database), I'm still new to MySql not know how to do

I appreciate your help
pawn Code:
command(email, playerid, params[])
{
    new
        email[128],
        emailstring[128],
        pname[20],
        msgadmins[128];

    if(sscanf(params, "s", email)) return SendClientMessage(playerid, Grey, "/email [email]");

    new File:emails=fopen("emails.txt", io_append);//********SAVING IN MYSQL? **********
    format(emailstring, sizeof(emailstring), "%s\n", email);//********SAVING IN MYSQL? **********
  fwrite(emails, emailstring);//********SAVING IN MYSQL? **********
  fclose(emails);//********SAVING IN MYSQL? **********
 
  GetPlayerName(playerid, pname, sizeof(pname));
  format(msgadmins, sizeof(msgadmins), "%s register email (%s).", pname, email);

    SendClientMessage(playerid, Green, "Thankx For Register!.");

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerAdmin(i))
            {
                SendClientMessage(i, Yellow, msgadmins);
            }
        }
    }
    return 1;
}
Sorry My Bad English, Iam Brazilian


Re: [DUV] Saving In MySql (/email) - ipsBruno - 26.05.2010

BuMp

Here My command
pawn Code:
command(email, playerid, params[])
{
new
email[128],
emailstring[128];
if(sscanf(params, "s", email)) return SendClientMessage(playerid, Grey, "/email [email]");
ConnectMySQL();
format(email,sizeof(email),"INSERT INTO `Usuarios` (`email`) VALUES ('%s')",email);
mysql_query(email);
SendClientMessage(playerid, Green, "Obrigado por registares o teu e-mail.");
return 1;
}

==============
** Not Save ***
==============


Re: [DUV] Saving In MySql (/email) - whitedragon - 26.05.2010

what you using? zcmd or what? you have all system in mysql?


Re: [DUV] Saving In MySql (/email) - ipsBruno - 26.05.2010

zcmd

yes completed

xD


Re: [DUV] Saving In MySql (/email) - whitedragon - 27.05.2010

Quote:
Originally Posted by DraKoN
zcmd

yes completed

xD
Ok try
format(email,sizeof(email),"INSERT INTO `Usuarios` (`email`) VALUES ('%s') WHERE ('%s')",email,pname); //he didnt know where to put it..