SA-MP Forums Archive
MySQL Saving Account Public Function - 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 Saving Account Public Function (/showthread.php?tid=520369)



MySQL Saving Account Public Function - AMouldyLemon - 18.06.2014

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 ";"



Re: MySQL Saving Account Public Function - Danijel. - 18.06.2014

Код:
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


Re: MySQL Saving Account Public Function - Konstantinos - 18.06.2014

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.


Re: MySQL Saving Account Public Function - AMouldyLemon - 18.06.2014

Can I have a link to that?


Re: MySQL Saving Account Public Function - iZN - 18.06.2014

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


Re: MySQL Saving Account Public Function - AMouldyLemon - 18.06.2014

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


Re: MySQL Saving Account Public Function - iZN - 18.06.2014

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