[eluser]bapobap[/eluser]
Hi there,
I am getting data from MySQL, an average rating, which I'd like to present as a percentage. So, my query calculates the average of a number of reviews and gives me a number, say 4.5, which means 4.5 out of 5.
In order to get a percentage, I use this:
Code:
->select('rating * 20 AS percentage')
to get the value expressed as a percentage.
For some unknown reason however, MySQL will sometimes return 80 and sometimes 100 with a value of 4.5. I'm not using any other code or using any rounding, the query is just as it is above, so I have no idea why MySQL thinks 4.5 * 20 is equal to either 80 or 100.
Anyone have any ideas?!