MySQL Saving Account Public Function
#1

I made this, don't know if it works, or is even correct. I get


pawn Код:
forward MasterAccountSave(playerid);
public MasterAccountSave(playerid)
{
    if(AccountExists(playerid))
    {
        if(MasterAccount[playerid][mLoggedIn])
        {
             new query[300]
             mysql_format(0, query, sizeof(query), "UPDATE `Master` (password,email_address,ip_address,super_admin,old_ip) VALUES ('%s', '%s', '%s', '%d', '%s', '%d')", MasterAccount[mPassword], MasterAccount[playerid][mEmailAddress], GetPlayerIPEx(playerid), MasterAccount[playerid][mSuperAdmin], MasterAccount[playerid][mOld_IP], MasterAccount[playerid][mID];// This line
             mysql_tquery(0, query, "", "");
           
           
           
            return true;
        }
    }
    return false;
}

Erros returned:
pawn Код:
(566) : error 001: expected token: ";", but found "-identifier-"
(566) : warning 213: tag mismatch
(566) : error 001: expected token: ",", but found ";"
Reply
#2

Код:
forward MasterAccountSave(playerid);
public MasterAccountSave(playerid)
{
    if(AccountExists(playerid))
    {
        if(MasterAccount[playerid][mLoggedIn])
        {
             new query[300]
             mysql_format(0, query, sizeof(query), "UPDATE `Master` (password,email_address,ip_address,super_admin,old_ip) VALUES ('%s', '%s', '%s', '%d', '%s', '%d')", MasterAccount[mPassword], MasterAccount[playerid][mEmailAddress], GetPlayerIPEx(playerid), MasterAccount[playerid][mSuperAdmin], MasterAccount[playerid][mOld_IP], MasterAccount[playerid][mID]);// This line
             mysql_tquery(0, query, "", "");
           
           
           
            return true;
        }
    }
    return false;
}
this should work
Reply
#3

You've used a combination of UPDATE and INSERT clause, read the mysql documentations for the correct syntax of UPDATE clause.

About the error, you need a closed paranthesis before the semicolon.
Reply
#4

Can I have a link to that?
Reply
#5

Quote:
Originally Posted by AMouldyLemon
Посмотреть сообщение
Can I have a link to that?
****** helps sir.

https://dev.mysql.com/doc/refman/4.1/en/update.html
https://dev.mysql.com/doc/refman/4.1/en/select.html
Reply
#6

I got to that, thought there would be something on BlueG's wiki of his MySQL plugin.
Reply
#7

Quote:
Originally Posted by AMouldyLemon
Посмотреть сообщение
I got to that, thought there would be something on BlueG's wiki of his MySQL plugin.
https://sampwiki.blast.hk/wiki/MySQL/R33 (The wiki is always up-to-date so don't worry about that if it's outdated)

Really why don't you ******?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)