allanch08
asked on
MYSQL decimal point
Hello experts.
I've come up with a simple 5-star rating system. Everything works fine but the calcualted answer is too long. ie. 2.4444 but I'd like it to be 2.44.
Do I be make this adjustment in MYSQL or PHP and how would i do it?
MYSQL statement:
SELECT ((1star+2star*2+3star*3+4s tar*4+5sta r*5)/(1sta r+2star+3s tar+4star+ 5star))
FROM rating
WHERE prod_id = colname
PHP to print answer is attached:
I've come up with a simple 5-star rating system. Everything works fine but the calcualted answer is too long. ie. 2.4444 but I'd like it to be 2.44.
Do I be make this adjustment in MYSQL or PHP and how would i do it?
MYSQL statement:
SELECT ((1star+2star*2+3star*3+4s
FROM rating
WHERE prod_id = colname
PHP to print answer is attached:
<?php echo $row_rsRating['((1star+2star*2+3star*3+4star*4+5star*5)/(1star+2star+3star+4star+5star))']; ?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for help everyone
ASKER