Re_Boot Posted April 25, 2008 Report Share Posted April 25, 2008 Em, es zinu ka shis maybe ir dubsh jautajums, bet man to vajag zinat: Kura no Datatype iek6 MySQL ir decimaldaljai, nu piemeram lai es field kura man vajag varu ierakstit 5.101, nu piem Datu tips INT, Boolean, text, decimal utt 1. Decimal man neder, vinjs kad es ielieku piem 5.0 parveido uz 5 2. TEXT man ari neder, tas parak daudz vietas aiznjem. Ir kadi varianti? Link to comment Share on other sites More sharing options...
andrisp Posted April 25, 2008 Report Share Posted April 25, 2008 Priekš naudām noteikti izmanto to pašu DECIMAL. Piemēram, DECIMAL(10,2). Ievadot 5, tas izskatīšies šādi: 5.00 Ja tās nav naudas, tad vari mēģināt izmanto FLOAT. Bet nullītes tāpat neredzēsi. Un floati arī nav diezko precīzi, ja sāk ar tiem veikt aritmētiskas darbības. Link to comment Share on other sites More sharing options...
Re_Boot Posted April 25, 2008 Author Report Share Posted April 25, 2008 (edited) Ah, man nedarbojas Decimal! :( Es lieku vai . vai , tapat parliek apakal uz 5 Edited April 25, 2008 by Re_Boot Link to comment Share on other sites More sharing options...
andrisp Posted April 25, 2008 Report Share Posted April 25, 2008 Skaidri zini, ka tabulas kolonai tipu pielaboji ? Link to comment Share on other sites More sharing options...
Re_Boot Posted April 25, 2008 Author Report Share Posted April 25, 2008 (edited) JAA! :( Field name: money, datatype: decimal, lenght: 65,0, default 100 Edited April 25, 2008 by Re_Boot Link to comment Share on other sites More sharing options...
andrisp Posted April 25, 2008 Report Share Posted April 25, 2008 vot, man liekas, ka nepareizi būs pielabojis. Tur, kur length, aiz komata vajag cipariņus. Link to comment Share on other sites More sharing options...
Re_Boot Posted April 25, 2008 Author Report Share Posted April 25, 2008 (edited) AA, liels paldies! :) Viss iet! :) Edited April 25, 2008 by Re_Boot Link to comment Share on other sites More sharing options...
Re_Boot Posted April 25, 2008 Author Report Share Posted April 25, 2008 andrisp, bet man velviens jautajums! Ka lai izmantojot ROUND() vai kadu citu komandu vinjs noapaljo skaitli kka shadi 5.00 vai 5.21 nevis ja piemeram ir 5.215643, tad lai vinjs kka 5.21 parada tikai desmitdaljas un simtdaljas. Link to comment Share on other sites More sharing options...
andrisp Posted April 25, 2008 Report Share Posted April 25, 2008 Nesapratu. Link to comment Share on other sites More sharing options...
bubu Posted April 25, 2008 Report Share Posted April 25, 2008 RTFM negribās? http://dev.mysql.com/doc/refman/5.1/en/mat...#function_round ROUND(X), ROUND(X,D) Rounds the argument X to D decimal places. Link to comment Share on other sites More sharing options...
Re_Boot Posted April 25, 2008 Author Report Share Posted April 25, 2008 Ka lai uztaisa taa ka no shadas decimaldaljas 5.212153426 vinjs noapaljo uz shadu 5.21. Ar to es domaju PHP Funkciju, kas kautko tadu dara. Link to comment Share on other sites More sharing options...
Re_Boot Posted April 25, 2008 Author Report Share Posted April 25, 2008 Ak paldies. Link to comment Share on other sites More sharing options...
andrisp Posted April 25, 2008 Report Share Posted April 25, 2008 http://lv2.php.net/round Un, starpcitu, DECIMAL(x,2) pats noapaļos, ja vajadzēs. Link to comment Share on other sites More sharing options...
Kristabs Posted April 26, 2008 Report Share Posted April 26, 2008 Laikam šis komentārs pa tēmu - http://lv2.php.net/manual/en/function.floor.php#81489 Link to comment Share on other sites More sharing options...
Recommended Posts