SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 20/03/2017, 09:16 PM   #1
Hackzzzz
Little Clucker
 
Join Date: Dec 2013
Posts: 28
Reputation: 1
Default Problem with INSERT

Hey guys, i have a problem with BlueG (R40) native "mysql_tquery".This function doesn't insert into the database.

Code:
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;
}
Hackzzzz is offline   Reply With Quote
Old 21/03/2017, 05:38 AM   #2
X337
Gangsta
 
Join Date: Sep 2014
Location: Indonesia
Posts: 806
Reputation: 160
Default Re: Problem with INSERT

Is there any errors/warnings in your mysql log?
__________________
viva la sa-mp

X337 is offline   Reply With Quote
Old 21/03/2017, 07:45 AM   #3
Hackzzzz
Little Clucker
 
Join Date: Dec 2013
Posts: 28
Reputation: 1
Default Re: Problem with INSERT

No, nothing
Hackzzzz is offline   Reply With Quote
Old 21/03/2017, 07:58 AM   #4
X337
Gangsta
 
Join Date: Sep 2014
Location: Indonesia
Posts: 806
Reputation: 160
Default Re: Problem with INSERT

Try this, i removed [128] in the format specifier. As far as i know, you don't need to provide string length for that.
Code:
mysql_tquery(dbHandle, query,"OnFurnitureInsert", "iiiiiisfff", houseid, interior, world, furnitureslot, model, price, name, x, y, z);
__________________
viva la sa-mp

X337 is offline   Reply With Quote
Old 21/03/2017, 08:22 AM   #5
Hackzzzz
Little Clucker
 
Join Date: Dec 2013
Posts: 28
Reputation: 1
Default Re: Problem with INSERT

Work. Thanks buddy. +Rep
Hackzzzz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL INSERT problem mrkiller90 Scripting Help 4 05/04/2016 05:57 PM
GPCI insert problem. rappy93 Scripting Help 4 04/07/2014 02:43 PM
Problem with MySQL insert ID AA9 Scripting Help 4 20/11/2013 10:05 PM
Insert problem Steeve_Smith Scripting Help 6 19/05/2012 08:55 AM
INSERT Problem Lewwy Help Archive 0 31/01/2011 03:32 PM


All times are GMT. The time now is 06:01 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.