mysql float
#1

hi I have probleme with the float in mysql when I insert float value in float row only the number before point aprear :

12341.1234221
only 12341 was registred??
Reply
#2

pawn Код:
new Float:X,Float:Y,Float:Z,pname[MAX_PLAYER_NAME];
GetPlayerPos(playerid,X,Y,Z);
GetPlayerName(playerid,pname,sizeof(pname));
format(query,sizeof(query),"UPDATE accounts SET PosX = %f, PosY = %f,PosZ = %f WHERE Name = %s",X,Y,Z,pname);
mysql_query(query);
create this in a timer after they logged in and spawned
Reply
#3

I do it but they save only te value before the point.. there is my code:


PHP код:

CMD
:hcreate(playeridparams[])
{
    new 
name[128],
        
price,
        
interrior,
        
Float:epos[3],
        
Float:tpos[3];
        
    if(
sscanf(params"s[128]iifff"namepriceinterrior,tpos[0],tpos[1],tpos[2])) return SendClientMessage(playeridCOLOR_ERROR"Usage hcreate [name][price][interriorId] [tposx] [tposy] [tposz]");
    new 
query[256],text[128];
    
GetPlayerPos(playeridepos[0], epos[1], epos[2]);
    
format querysizeof(query), "INSERT INTO houses(name, owner, owned, price, interrior, vw, eposx, eposy, eposz, tposx, tposy, tposz) VALUES ( '%s', 'noname', 0, %d, %d, %d, %f, %f, %f, %f, %f, %f )"namepriceinterrior0epos[0], epos[1], epos[2], tpos[0], tpos[1], tpos[2]);
    
mysql_query(query);
    
CreateDynamicPickup(12731epos[0], epos[1], epos[2]);
    
format(textsizeof(text), "Propriиtaire : %s\nPrix : %d""noname"price);
    
CreateDynamic3DTextLabel(textCOLOR_GREENepos[0], epos[1], epos[2]+0.610);
    return 
1;

Reply
#4

Edit your table structure for the float values. Change its type from INT to FLOAT.
Reply
#5

I alerady change its but dont want to work ( its work for you??));

Код:
id 	int(5) 			Non 	Aucune 	AUTO_INCREMENT 	Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	2 	name 	varchar(128) 	utf8_general_ci 		Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	3 	owner 	varchar(25) 	utf8_general_ci 		Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	4 	owned 	tinyint(1) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	5 	price 	int(15) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	6 	interrior 	int(5) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	7 	vw 	int(25) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	8 	eposx 	float(128,0) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	9 	eposy 	double(128,0) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	10 	eposz 	double(128,0) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	11 	tposx 	double(128,0) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	12 	tposy 	double(128,0) 			Non 	Aucune 		Modifier Modifier 	Supprimer Supprimer 	plus Montrer d'autres actions
	13 	tposz 	double(128,0) 			Non 	Aucu
Reply
#6

UPppp
Reply
#7

add ' ' in each number after VALUES
pawn Код:
format ( query, sizeof(query), "INSERT INTO houses(name, owner, owned, price, interrior, vw, eposx, eposy, eposz, tposx, tposy, tposz) VALUES ( '%s', 'noname', '0', '%d', '%d',' %d', '%f',' %f', '%f', '%f', '%f', '%f ')", name, price, interrior, 0, epos[0], epos[1], epos[2], tpos[0], tpos[1], tpos[2]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)