Question

[17:28:41 06/20/22] [ERROR] CMySQLQuery::Execute - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`pLevel` = '49',`pMail` = 'Cк)',`pX` = '2488.057128',`pY` = '15.960000',`pZ` =' at line 1 (Query: "`pLevel` = '49',`pMail` = 'Cк)',`pX` = '2488.057128',`pY` = '15.960000',`pZ` = '0.000000',`pSex` = '18',`pAge` = '30',`pSkin` = '12' WHERE `pID` = ''")

new query[200];
format(query,sizeof(query),"UPDATE `players` SET `pName` = '%s',`pPassword` = '%s',`pAdmin` = '%i',`pAdminPass` = '%s',`pMoney` = '%i',",pInfo[playerid][pName],pInfo[playerid][pPassword],pInfo[playerid][pAdmin],pInfo[playerid][pAdminPass],pInfo[playerid][pMoney]);
format(query,sizeof(query),"%s`pLevel` = '%i',`pMail` = '%s',`pX` = '%f',`pY` = '%f',`pZ` = '%f',`pSex` = '%i',`pAge` = '%i',`pSkin` = '%d' WHERE `pID` = '%i'",pInfo[playerid][pLevel],pInfo[playerid][pMail],pInfo[playerid][pX],pInfo[playerid][pY],pInfo[playerid][pZ],pInfo[playerid][pSex],pInfo[playerid][pAge],pInfo[playerid][pSkin],pInfo[playerid][pID]);
mysql_query(dbHandle,query);

 

Edited by Antoxa39

Share this post


Link to post

1 answer to this question

  • 0

@Antoxa39, для скрепления строк через format Вы добавили спецификатор %s вначале второй, но не добавили переменную со строкой для этого спецификатора. В результате на сервер уходит запрос, представляющий собой одну лишь вторую строку.

 

new query[200];
format(query,sizeof(query),"UPDATE `players` SET `pName` = '%s',`pPassword` = '%s',`pAdmin` = '%i',`pAdminPass` = '%s',`pMoney` = '%i',",pInfo[playerid][pName],pInfo[playerid][pPassword],pInfo[playerid][pAdmin],pInfo[playerid][pAdminPass],pInfo[playerid][pMoney]);
format(query,sizeof(query),"%s`pLevel` = '%i',`pMail` = '%s',`pX` = '%f',`pY` = '%f',`pZ` = '%f',`pSex` = '%i',`pAge` = '%i',`pSkin` = '%d' WHERE `pID` = '%i'",query,pInfo[playerid][pLevel],pInfo[playerid][pMail],pInfo[playerid][pX],pInfo[playerid][pY],pInfo[playerid][pZ],pInfo[playerid][pSex],pInfo[playerid][pAge],pInfo[playerid][pSkin],pInfo[playerid][pID]);
mysql_query(dbHandle,query);

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0