[MySQL]: Unknown column 'HOwned' in 'field list' -
vassilis - 19.11.2015
PHP код:
[18:48:38] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[18:48:38] [ERROR] CMySQLQuery::Execute[] - (error #1054) Unknown column 'HOwned' in 'field list'
[18:48:38] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
[18:48:38] [DEBUG] Calling callback "OnQueryError"..
That happens when i create a house
createhouse function
PHP код:
function CreateHouse(Float:Xen,Float:Yen,Float:Zen,Float:Xex,Float:Yex,Float:Zex,virtualworld,interiorid,price)
{
static hCount;
new hid = hCount; hCount += 1;
new string[100];
new query[500];
hid += 1;
HouseInfo[hid][XEnt] = Xen;
HouseInfo[hid][YEnt] = Yen;
HouseInfo[hid][ZEnt] = Zen;
HouseInfo[hid][XExit] = Xex;
HouseInfo[hid][YExit] = Yex;
HouseInfo[hid][ZExit] = Zex;
HouseInfo[hid][HVirtualWorld] = virtualworld;
HouseInfo[hid][HInterior] = interiorid;
HouseInfo[hid][HPrice] = price;
HouseInfo[hid][HOwned] = 0;
HouseInfo[hid][HLocked] = 0;
format(string,sizeof(string),""COL_GREEN"HouseName"COL_WHITE": No Owner\n"COL_GREEN"Price"COL_WHITE": %d",price);
Create3DTextLabel(string, COLOR_YELLOW, Xen, Yen, Zen, 40.0, 0, 0);
strcat(query,"INSERT INTO `houses` (`XEnt`, `YEnt`, `ZEnt`, `XExit`, `YExit`, `ZExit`, `HVirtualWorld` ,`HInterior`, `HPrice`");
format(query, "%s, `HOwner`, `HOwned`, `HLocked`, `HName`) VALUES (%d, %d, %d, %d, %d, %d, %d, %d, %d, 'UnOwned', 0, 0, 'For Sale')",Xen,Yen,Zen,Xex,Yex,Zex,virtualworld,interiorid,price);
mysql_tquery(mysql, query);
HouseInfo[hid][hID] = cache_insert_id();
printf("New house registered. HID: %d", HouseInfo[hid][hID]); //just for debugging.
return 1;
}
Re: [MySQL]: Unknown column 'HOwned' in 'field list' -
Jefff - 19.11.2015
pawn Код:
query = "INSERT INTO `houses` (`XEnt`, `YEnt`, `ZEnt`, `XExit`, `YExit`, `ZExit`, `HVirtualWorld` ,`HInterior`, `HPrice`";
format(query, sizeof(query), "%s, `HOwner`, `HOwned`, `HLocked`, `HName`) VALUES (%.4f, %.4f, %.4f, %.4f, %.4f, %.4f, %d, %d, %d, 'UnOwned', 0, 0, 'For Sale')",query,Xen,Yen,Zen,Xex,Yex,Zex,virtualworld,interiorid,price);
mysql_tquery(mysql, query);
HouseInfo[hid][hID] = hid;
printf("New house registered. HID: %d", HouseInfo[hid][hID]); //just for debugging.
Re: [MySQL]: Unknown column 'HOwned' in 'field list' -
PrO.GameR - 19.11.2015
'UnOwned'
You are sending a string into a tinyint column ^^^
Re: [MySQL]: Unknown column 'HOwned' in 'field list' -
vassilis - 20.11.2015
How to set as default when it creates a house word "Unowned" and "NoOwner" ?
i call a string at HOwner and HName
Re: [MySQL]: Unknown column 'HOwned' in 'field list' -
PrO.GameR - 20.11.2015
Actually I missed one 0, it's not the 'UnOwned' but your query is all weird tho
Why did you make X,Y,Z 255 varchar(string) fields ? make them float 12,6 (thats all the precision you need) and use %f instead of %d
Re: [MySQL]: Unknown column 'HOwned' in 'field list' -
yvoms - 20.11.2015
Float is an approximate, where Varchar or char is exact.
Re: [MySQL]: Unknown column 'HOwned' in 'field list' -
vassilis - 20.11.2015
Quote:
Originally Posted by yvoms
Float is an approximate, where Varchar or char is exact.
|
SO am i correct to use varchar?