SA-MP Forums Archive
Problem with updating (MySQL R33) - 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: Problem with updating (MySQL R33) (/showthread.php?tid=567519)



Problem with updating (MySQL R33) - FunnyBear - 14.03.2015

Hey,

I'm trying to finish with my MySQL based house system, and I came across a problem. This is the error that I get in the debug,

Код:
[14:42:49] [DEBUG] CMySQLQuery::CMySQLQuery() - constructor called
[14:42:49] [DEBUG] mysql_tquery - scheduling query "UPDATE `houses` SET `Owned`=1, `Owner`=itsDanny WHERE `ID` = '6'"..
[14:42:49] [DEBUG] CMySQLQuery::Execute[()] - starting query execution
[14:42:49] [ERROR] CMySQLQuery::Execute[()] - (error #1054) Unknown column 'itsDanny' in 'field list'
[14:42:49] [DEBUG] CMySQLQuery::Execute[()] - error will be triggered in OnQueryError
[14:42:49] [DEBUG] CMySQLQuery::Execute[()] - data being passed to ProcessCallbacks()
[14:42:49] [DEBUG] Calling callback "OnQueryError"..
[14:42:49] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
This happens after I buy a house. I don't see anything wrong with the code. Anyway, here it is:

Код:
hInfo[id][Owned] = 1;
                hInfo[id][Owner] = Name[playerid];

				mysql_format(mysql, query, sizeof(query), "UPDATE `"HouseTable"` SET `Owned`=%i, `Owner`=%e WHERE `ID` = '%i'", hInfo[id][Owned], hInfo[id][Owner], id);
				mysql_tquery(mysql, query, "", "");
Thanks


AW: Problem with updating (MySQL R33) - Kaliber - 14.03.2015

Write it like this:

Код:
"UPDATE `HouseTable` SET `Owned`='%i', `Owner`='%e' WHERE `ID` = '%i'"
Greekz


Re: AW: Problem with updating (MySQL R33) - FunnyBear - 14.03.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Write it like this:

Код:
"UPDATE `HouseTable` SET `Owned`='%i', `Owner`='%e' WHERE `ID` = '%i'"
Greekz
No, that's not the problem. I've defined the table name so I have to use the speech marks (" ")


Re: Problem with updating (MySQL R33) - Evocator - 14.03.2015

Give this a shot:
Код:
	mysql_format(mysql, query, sizeof(query), "UPDATE `"HouseTable"` SET `Owned`='%i', `Owner`='%e' WHERE `ID` = '%i'", hInfo[id][Owned], hInfo[id][Owner], id);
	mysql_tquery(mysql, query);
Most likely you are not setting a limit for the strings inside the query, and thus considering it a field.


Re: Problem with updating (MySQL R33) - Misiur - 14.03.2015

Owner is a string field, try what people are posting and it will work...