Mysql problem
#1

Hi all. I have a problem. I have
PHP код:
stock SavePlayerData(playerid

    new 
sqlSaveString[2048]; 
    
mysql_format(handlesqlSaveString2048"UPDATE (`Inviter`, `Name`, `Password`, `Sex`, `Skin`) SET ('%s', '%s', '%s', %d, %d)"PI[playerid][pInviter], GetName(playerid), PI[playerid][pPassword], PI[playerid][pSex], PI[playerid][pSkin]); 
    
mysql_tquery(handlesqlSaveString""""); 
    return 
1

and I have error
PHP код:
[09:57:51] [DEBUGmysql_format connection1len2048format"UPDATE (`Inviter`, `Name`, `Password`, `Sex`, `Skin`) SET ('%s', '%s', '%s', %d, %d)" 
[09:57:51] [DEBUGmysql_tquery connection1query"UPDATE (`Inviter`, `Name`, `Password`, `Sex`, `Skin`) SET ('', '"callback"(null)"format"(null)" 
[09:57:51] [DEBUGCMySQLQuery::Execute[] - starting query execution 
[09:57:51] [ERRORCMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('', '', '', 0, 15)' at line 1 
[09:57:51] [DEBUGCMySQLQuery::Execute[] - error will be triggered in OnQueryError 
Reply
#2

That's nt how UPDATE queries work.

pawn Код:
mysql_format(handle, sqlSaveString, 2048, "UPDATE table_name SET `Inviter` = '%s', `Name` = '%s', Password = '%s', Sex = %d, Skin = %d", PI[playerid][pInviter], GetName(playerid), PI[playerid][pPassword], PI[playerid][pSex], PI[playerid][pSkin]);  
    mysql_tquery(handle, sqlSaveString, "", "");
Change the 'table_name' to your table name. Also as there is no WHERE clause it will set these values for ALL rows and I'm quite sure that's not what you want.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)