Jump to content

why is DOUBLE getting roounded?


dflow

Recommended Posts

i have an AVG result

it is echoed fine with the decimal point

and i want it to be inserted as a double:

($_POST['AVGrating'], "double"),
and set in the db as a double

 

but the inserted value in the db is rounded down

for example 3.80 is 3.00

 

any ideas?

 

 

Link to comment
Share on other sites

PHP automatically rounds decimal numbers to whole-numbers.

Only in certain contexts.

 

@dflow, you're going to need to show us more code that is relevant to your problem.  We need to know how the value is created (or where it's coming from) and see how you're trying to insert it into your database.

 

We'd also need to know the table structure for the table you're inserting into.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.