[DUV] Saving In MySql (/email)
#1

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

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 ***
==============
Reply
#3

what you using? zcmd or what? you have all system in mysql?
Reply
#4

zcmd

yes completed

xD
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)