UK Webmaster Talk - Online Marketing - SEO


 

Rounding Down

This is a discussion on Rounding Down within the Php and MySQL forums, part of the Programming / Scripting / Coding category; So, I want to store a number into a MySQL DB. Except it's numbers like 90.5 or 110.123 and numbers ...


Go Back   UK Webmaster Talk - Online Marketing - SEO > Website Design & Development > Programming / Scripting / Coding > Php and MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices

Reply

 

LinkBack Thread Tools Display Modes
Old 22-05-2005, 23:10   #1 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 128
iTrader: 0 / 0%
SirJinX is on a distinguished road
Default Rounding Down

So,
I want to store a number into a MySQL DB.
Except it's numbers like 90.5 or 110.123 and numbers like that.
If I put it on float, it saves it the way it is. If I put it on integer, it rounds it up.
Anyone know how to round it down?

Thanks

Last edited by SirJinX; 23-05-2005 at 03:29.
SirJinX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 22-05-2005, 23:22   #2 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 278
iTrader: 0 / 0%
Cridiron is on a distinguished road
Send a message via AIM to Cridiron
Default

Uhmmm it seems like you answered your own question...put it as an integer...
__________________
Cridiron.com
Cridiron is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 23-05-2005, 03:29   #3 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 128
iTrader: 0 / 0%
SirJinX is on a distinguished road
Default

Dam, I ment it round it up :S
Going to edit the post...
SirJinX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 23-05-2005, 17:53   #4 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 278
iTrader: 0 / 0%
Cridiron is on a distinguished road
Send a message via AIM to Cridiron
Default

Does it round up no matter what? like I know it will round up if it's 5 or over, but will it still round up if it's a number like 12.1? Cause mathematically, it should be rounded down because the decimal is lower than 5.
__________________
Cridiron.com
Cridiron is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 23-05-2005, 18:58   #5 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 128
iTrader: 0 / 0%
SirJinX is on a distinguished road
Default

It was a long time ago since I checked for it tough,
I don't quite remember

Except, I would still like the numbers about x.5 to be rounded down...
SirJinX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 23-05-2005, 20:52   #6 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 278
iTrader: 0 / 0%
Cridiron is on a distinguished road
Send a message via AIM to Cridiron
Default

Hmmm I don't know...I'm not very good with storing numbers and values into databases. Sorry... You can try googling it though
__________________
Cridiron.com
Cridiron is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 25-05-2005, 15:45   #7 (permalink)
Active Member
 
Join Date: May 2005
Location: Doncaster, UK
Posts: 58
iTrader: 0 / 0%
vegancoder is on a distinguished road
Send a message via MSN to vegancoder
Default

use this function to round down to the next integer:

PHP Code:
floor(); 
Then insert the new value into the database, hope that helps
vegancoder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 25-05-2005, 20:08   #8 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 128
iTrader: 0 / 0%
SirJinX is on a distinguished road
Default

ok thanks, I will try that later
SirJinX is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 27-05-2005, 02:30   #9 (permalink)
Active Member
 
Join Date: May 2005
Location: Doncaster, UK
Posts: 58
iTrader: 0 / 0%
vegancoder is on a distinguished road
Send a message via MSN to vegancoder
Wink

it should work, i hope it does, its nice to help people
vegancoder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
rounding

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 20:10.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
UK Webmaster Forum © WebmasterTalk.co.uk | Design by Forbairt

Ad Management by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41