PHP is not returning me a number type

Posted by Tristan on Stack Overflow See other posts from Stack Overflow or by Tristan
Published on 2010-04-24T02:09:45Z Indexed on 2010/04/24 2:13 UTC
Read the original article Hit count: 226

Filed under:
|
|
|
|

Hello, i tryed to follow that great tutorial (STAR rating with css : http://stackoverflow.com/questions/1987524/turn-a-number-into-star-rating-display-using-jquery-and-css)

but i've just a big problem : When i do

<span class="stars">1.75</span>

or

$foo='1.75';
echo '<span class="stars">'.$foo.'</span>

the stars is correctly shown, but as soon as i do :

while($val = mysql_fetch_array($result)) 
{  
$average =  ($val['services'] + $val['serviceCli']  + $val['interface'] + $val['qualite'] + $val['rapport'] )  / 5 ;

<span class="stars">.$average.</span>
}

the stars stops working

i double checked the data type in mysql : they're all TINYINT(2)

and i tryed that :

$average = intval($average);

but it's still not working,

Thank you

© Stack Overflow or respective owner

Related posts about php

Related posts about numeric