mysql float -
jaskiller - 07.01.2012
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??
Re: mysql float -
Tanush123 - 07.01.2012
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
Re : mysql float -
jaskiller - 07.01.2012
I do it but they save only te value before the point.. there is my code:
PHP код:
CMD:hcreate(playerid, params[])
{
new name[128],
price,
interrior,
Float:epos[3],
Float:tpos[3];
if(sscanf(params, "s[128]iifff", name, price, interrior,tpos[0],tpos[1],tpos[2])) return SendClientMessage(playerid, COLOR_ERROR, "Usage hcreate [name][price][interriorId] [tposx] [tposy] [tposz]");
new query[256],text[128];
GetPlayerPos(playerid, epos[0], epos[1], epos[2]);
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]);
mysql_query(query);
CreateDynamicPickup(1273, 1, epos[0], epos[1], epos[2]);
format(text, sizeof(text), "Propriиtaire : %s\nPrix : %d", "noname", price);
CreateDynamic3DTextLabel(text, COLOR_GREEN, epos[0], epos[1], epos[2]+0.6, 10);
return 1;
}
Re: mysql float -
Vince - 07.01.2012
Edit your table structure for the float values. Change its type from INT to FLOAT.
Re : mysql float -
jaskiller - 07.01.2012
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
Re : mysql float -
jaskiller - 07.01.2012
UPppp
Re: mysql float -
Tanush123 - 07.01.2012
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]);