PDA

View Full Version : Problem with INSERT


Hackzzzz
20/03/2017, 09:16 PM
Hey guys, i have a problem with BlueG (R40) native "mysql_tquery".This function doesn't insert into the database.

stock OnPlayerBuyFurniture(houseid, interior, world, furnitureslot, model, price, name[], Float:x, Float:y, Float:z)
{
mysql_format(dbHandle, query, sizeof(query), "INSERT INTO `furnitures` (model, name, houseid, interior, virworld, marketprice, posx, posy, posz) VALUES (%d, '%s', %d, %d, %d, %d, %f, %f, %f)",
model, name, HouseInfo[houseid][hID], interior, world, price, x, y ,z);
mysql_tquery(dbHandle, query,"OnFurnitureInsert", "iiiiiis[128]fff", houseid, interior, world, furnitureslot, model, price, name, x, y, z);
return 1;
}

public OnFurnitureInsert(houseid, interior, world, furnitureslot, model, price, name[], Float:x, Float:y, Float:z)
{
FurnitureInfo[houseid][furnitureslot][fID] = cache_insert_id();
FurnitureInfo[houseid][furnitureslot][fHouseID] = houseid;
FurnitureInfo[houseid][furnitureslot][fInterior] = interior;
FurnitureInfo[houseid][furnitureslot][fVirtualWorld] = world;
FurnitureInfo[houseid][furnitureslot][fMarketPrice] = price;
FurnitureInfo[houseid][furnitureslot][fModel] = model;
FurnitureInfo[houseid][furnitureslot][fPosX] = x;
FurnitureInfo[houseid][furnitureslot][fPosY] = y;
FurnitureInfo[houseid][furnitureslot][fPosZ] = z;
FurnitureInfo[houseid][furnitureslot][fPosRX] = 0.0;
FurnitureInfo[houseid][furnitureslot][fPosRY] = 0.0;
FurnitureInfo[houseid][furnitureslot][fPosRZ] = 0.0;
format(FurnitureInfo[houseid][furnitureslot][fName], 128, "%s", name);
FurnitureInfo[houseid][furnitureslot][fOn] = 1;
return 1;
}

X337
21/03/2017, 05:38 AM
Is there any errors/warnings in your mysql log?

Hackzzzz
21/03/2017, 07:45 AM
No, nothing

X337
21/03/2017, 07:58 AM
Try this, i removed [128] in the format specifier. As far as i know, you don't need to provide string length for that.

mysql_tquery(dbHandle, query,"OnFurnitureInsert", "iiiiiisfff", houseid, interior, world, furnitureslot, model, price, name, x, y, z);

Hackzzzz
21/03/2017, 08:22 AM
Work. Thanks buddy. +Rep