30.10.2015, 04:56
What am i doing wrong with this code? Apparently there is something wrong with the query (or stings).
It outputs this in console:
Please, someone that knows these things, take a look at the code.
pawn Код:
else if(db_num_rows(Result)) // The house ID is in the database. Update the values
{
print("House found in database! Updaing...");
new Owned33 = 0;
if(AHouseData[HouseID][Owned] == true)
{
Owned33 = 1;
}
else if(AHouseData[HouseID][Owned] == true)
{
Owned33 = 0;
}
printf("House owned %d House Owner %s", Owned33, AHouseData[HouseID][Owner]);
// strcat(HouseStrCat, "UPDATE `Houses` SET `HouseAddress` = '%s', `HouseName` = '%s', `HouseX` = '%f', `HouseY` = '%f', `HouseZ` = '%f', `HouseInterior` = '%d', `HouseMaxSlots` = '%d', `HouseNewMaxSlots` = '%d', `HousePrice` = '%d', `Owned` = '%d', `HouseOpened` = '%d', ", sizeof(HouseStrCat)); // 11
// strcat(HouseStrCat, "`PlayerIsTycoon` = '%d', `Owner` = '%s', `Insurance` = '%d' WHERE `HouseID` = '%d'", sizeof(HouseStrCat)); // 15
print("Failstep 9");
format(Query, sizeof(Query), "UPDATE `Houses` SET `HouseAddress` = '%s', `HouseName` = '%s', `HouseX` = '%f', `HouseY` = '%f', `HouseZ` = '%f', `HouseInterior` = '%d', `HouseMaxSlots` = '%d', `HouseNewMaxSlots` = '%d', `HousePrice` = '%d', `Owned` = '%d', `HouseOpened` = '%d', `PlayerIsTycoon` = '%d', `Owner` = '%s', `Insurance` = '%d' WHERE `HouseID` = '%d'",
AHouseData[HouseID][HouseAddress], AHouseData[HouseID][HouseName], AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ], AHouseData[HouseID][HouseInterior], AHouseData[HouseID][HouseMaxSlots], AHouseData[HouseID][HouseNewMaxSlots], AHouseData[HouseID][HousePrice], Owned33,
AHouseData[HouseID][HouseOpened], AHouseData[HouseID][PlayerIsTycoon], AHouseData[HouseID][Owner], AHouseData[HouseID][Insurance], HouseID); // 15
print("Failstep 10");
db_free_result(db_query(Database, Query));
print("Failstep 11");
// strdel(HouseStrCat, 0, 800);
print("Failstep 12");
}
Код:
[06:36:23] House found in database! Updaing... [06:36:23] House owned 1 House Owner Kulottaja [06:36:23] Failstep 9 [06:36:23] Failstep 10 [06:36:23] SQLitei Notice: (db_free_result_hook) Invalid result given. [06:36:23] Failstep 11 [06:36:23] Failstep 12