Formating issue -
TwinkiDaBoss - 20.11.2015
Well basically tittle says all.
pawn Код:
new query[1024] = "UPDATE `houses` SET `HouseName`=%s,`Price`=%i,`EnterX`=%f,`EnterY`=%f,`EnterZ`=%f,`ExitX`= %f,`ExitY`=%f,`ExitZ`=%f,`VirtualWorld`=%i,`InteriorID`=%i,`Owned`=%i,`Garage`=%i,`Locked`=%i,`HouseBank`=%i WHERE `ID`=%d";
format(query, sizeof(query), query, HouseInfo[x][HouseName],HouseInfo[x][HousePrice],
HouseInfo[x][EnterX],HouseInfo[x][EnterY],HouseInfo[x][EnterZ],
HouseInfo[x][ExitX],HouseInfo[x][ExitY],HouseInfo[x][ExitZ],
HouseInfo[x][VirtualWorld],
HouseInfo[x][Interior],HouseInfo[x][Owned],HouseInfo[x][Garage],HouseInfo[x][Locked],
HouseInfo[x][HouseBank],HouseInfo[x][ID]);
mysql_tquery(mysql, query, "", "");
Erorrs & warnings
SA:MP warning 213: tag mismatch (For Format(query,sizeof(query))
SQL log
pawn Код:
[05:04:28] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `houses` SET `HouseName`=TwinkisHub,`Price`=1000,`EnterX`", callback: "(null)", format: "(null)"
[05:04:28] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[05:04:28] [ERROR] CMySQLQuery::Execute[] - (error #1054) Unknown column 'TwinkisHub' in 'field list'
[05:04:28] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
Printed the Query
pawn Код:
UPDATE `houses` SET `HouseName`=TwinkisHub,`Price`=1000,`EnterX`=1970.709960,`EnterY`=1344.099975,`EnterZ`=15.437999,`ExitX`= 0.000000,`ExitY`=0.000000,`ExitZ`=0.000000,`VirtualWorld`=0,`InteriorID`=0,`Owned`=0,`Garage`=0,`Locked`=0,`HouseBank`=0 WHERE `ID`=3
Im not sure why is it saying 'TwinkisHub' is not in field list, its under "HouseName" but i get the point, I dont understand why is it reading it as separate row or such...
Re: Formating issue -
itsCody - 20.11.2015
Try replacing
PHP код:
format(query, sizeof(query), query, HouseInfo[x][HouseName],HouseInfo[x][HousePrice],
with
PHP код:
format(query, sizeof(query), "%s", query, HouseInfo[x][HouseName],HouseInfo[x][HousePrice],
Also, I don't understand your problem that great, so sorry if I didn't understand it.
Re: Formating issue -
Wizzy951 - 20.11.2015
Change
pawn Код:
format(query, sizeof(query), query,
to
pawn Код:
format(query, sizeof(query),
i.e. remove the second "query" .
Also about your other error make sure the spelling of the field names is identical with your field names in the script (HouseName should be spelled the same way in your mysql table)
Re: Formating issue -
PrO.GameR - 20.11.2015
It has absolutely nothing to do with these things you said (although they are a fail in scripting .. but problem is MYSQL syntax)
when sending queries to mysql, strings should be opened and closed with ' like 'PlayerName' your string is not between those
`HouseName`=TwinkisHub < to 'TwinkisHub'
Re: Formating issue -
iGetty - 20.11.2015
Also advised to use "mysql_format" instead of "format".
pawn Код:
new query[500];
mysql_format(MySQLHandle, query, sizeof(query), "UPDATE `houses` SET `HouseName`='%e', `Price`=%i, `EnterX`=%f, `EnterY`=%f, `EnterZ`=%f, `ExitX`= %f, `ExitY`=%f, `ExitZ`=%f, `VirtualWorld`=%i, `InteriorID`=%i,` Owned`-%i, `Garage`=%i, `Locked`=%i, `HouseBank`=%i WHERE `ID`=%d", HouseInfo[x][HouseName],HouseInfo[x][HousePrice],
HouseInfo[x][EnterX],HouseInfo[x][EnterY],HouseInfo[x][EnterZ], HouseInfo[x][ExitX],HouseInfo[x][ExitY],HouseInfo[x][ExitZ], HouseInfo[x][VirtualWorld], HouseInfo[x][Interior],HouseInfo[x][Owned],HouseInfo[x][Garage],HouseInfo[x][Locked], HouseInfo[x][HouseBank],HouseInfo[x][ID]);
mysql_tquery(mysql, query);
Try that and look at this:
https://sampwiki.blast.hk/wiki/MySQL/R33#mysql_format
Re: Formating issue -
TwinkiDaBoss - 20.11.2015
-Resolved-
Thanks! +rep