Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 2 years ago.
0

jimgwhit said:

http://php.net/manual/en/function.number-format.php

Yes I'm aware of that. It doesn't solve the problem as going thru Eloquent the float is changed, and not with plain PHP querying – so the problem must be with Eloquent.

0

where it's returning 330, what is the actual value stored in the database? Try to store 330.152 for example and pluck that to test.
Update, I just tryed it, it's returning for me 390.1463, which is what I entered in database. Are you sure you have datatype float in database?

Last updated 9 years ago.
0

jimgwhit said:

where it's returning 330, what is the actual value stored in the database? Try to store 330.152 for example and pluck that to test.
Update, I just tryed it, it's returning for me 390.1463, which is what I entered in database. Are you sure you have datatype float in database?

The problem is that the database has 333.33 as it should when looked with PhpMyAdmin. The schema is with with float() and default value 0.00 for all those field. And it seems the database also writes the float fine – but when queried thru Eloquent it returns 330 (of type double).

Today I'm finishing building an almost identical Vagrant instance than with our host, so that I can test PHP 5.4.36 + MySQL 5.5.40 combination with this Laravel version...

Last updated 9 years ago.
0

this is why its important to have test server before updating the live site with the latest updates.. (i know its not helpful but one for the future)

0

I have opened an issue on this after trying to replicate the problem locally with nearly identical Vagrant platform: https://github.com/laravel/framework/issues/7075

Last updated 9 years ago.
0

This issue was never solved... Migrated to another server to start afresh.

0

I have the same problem, and i have found a solution.

You need to use float() in your migration file. And not to change your input type in your database, because the float() function create a "double" type in your database and not a "float" type. Try to change in double and it'll work fine!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

envision envision Joined 15 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.