peddel Posted February 3, 2009 Share Posted February 3, 2009 I got a table filled with float values. When i join it with other tables, my floats get out in this form 24.390503839 Is it possible to limit the floats with a command so that i get for example 24.39? Thx in advance Link to comment https://forums.phpfreaks.com/topic/143589-solved-limiting-float-element-tables/ Share on other sites More sharing options...
Philip Posted February 3, 2009 Share Posted February 3, 2009 Take a look into ROUND(), it should be what you're looking for Link to comment https://forums.phpfreaks.com/topic/143589-solved-limiting-float-element-tables/#findComment-753829 Share on other sites More sharing options...
peddel Posted February 4, 2009 Author Share Posted February 4, 2009 Take a look into ROUND(), it should be what you're looking for Thx man, seems indeed what im looking for ^^ Link to comment https://forums.phpfreaks.com/topic/143589-solved-limiting-float-element-tables/#findComment-754159 Share on other sites More sharing options...
peddel Posted February 4, 2009 Author Share Posted February 4, 2009 Dear KingFilip, i tought i found the solution, but it seems i did not. My MySQL query $sql = "SELECT view1.tag, view1.waarde FROM registratie " ."LEFT JOIN view1 ON registratie.registratieID = view1.registratieID " ."LEFT JOIN oorsprong_gegevens ON registratie.oorsprong = oorsprong_gegevens.oorsprong " ."WHERE registratie.productieregister = '1' AND view1.tag = 'uurtellerAmmoniak' "; The thing now is that when the tag is a float and it finds a float value, i ask through php to add the value to a webpage on a certain position. The representation is 34.919955433 Now where do i place best the ROUND() function in my query, to be sure i get 34,92. OR do i need to do the rounding in PHP ? Link to comment https://forums.phpfreaks.com/topic/143589-solved-limiting-float-element-tables/#findComment-754219 Share on other sites More sharing options...
peddel Posted February 4, 2009 Author Share Posted February 4, 2009 I solved it It was easily done by using the PHP round() function. Thx for ur help again ^^ Link to comment https://forums.phpfreaks.com/topic/143589-solved-limiting-float-element-tables/#findComment-754224 Share on other sites More sharing options...
fenway Posted February 6, 2009 Share Posted February 6, 2009 No idea what you mean... but you can use ROUND() in mysql too. Link to comment https://forums.phpfreaks.com/topic/143589-solved-limiting-float-element-tables/#findComment-755798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.