AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   how to store float on sql table (https://forums.alliedmods.net/showthread.php?t=318541)

farawayf 09-06-2019 10:30

how to store float on sql table
 
PHP Code:

CREATE TABLE IF NOT EXISTS `players` (`steamidVARCHAR(32NOT NULL, `nameVARCHAR(32), `floatVARCHAR(32NOT NULL PRIMARY KEY (`steamid`)) 

Getting like float[client] = results.FetchFloat(0);

i did not find enough information on how to store float on sql table, so i dont know if im doing this right or not.
Is it right to store float like VARCHAR ? if not then how ?

Mesharsky How2Kill 09-06-2019 20:40

Re: how to store float on sql table
 
Why can't you just store float as float?
Why you put it as VARCHAR?

PHP Code:

CREATE TABLE IF NOT EXISTS `players` (`steamidVARCHAR(32NOT NULL, `nameVARCHAR(32), `floatFLOAT(SIZE,dNOT NULL PRIMARY KEY (`steamid`)) 

FLOAT(size, d)
The number of digits after the decimal point is specified in the d parameter


All times are GMT -4. The time now is 10:46.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.