Hi, I have a script like this <span class="featrate">'. get_post_meta($key="taq_review_score", true). get_post_meta($post->ID, $key, true). '</span> / 10'. '</td> PHP: In mysql database I have a "meta_key" --> "taq_review_score" and "meta_values" like 95.2222222222, 84.6666666667, 96.8888888889... My question is if is possible trim the "meta_values" to show numbers like 9.5, 8.4, 9,6... Table "taq_review_score" I need to show values like 9.7 instead of 97.4444444444 - 9.6 instead of 96.1111111111 and so one. Thank you for your help
I would use round function - http://php.net/manual/en/function.round.php <span class="featrate">'. round(get_post_meta($key="taq_review_score", true)). get_post_meta($post->ID, $key, true). '</span> / 10'. '</td> PHP:
Hi, Thank you already made it <span class="featrate">'. (get_post_meta($key="taq_review_score", true)). round(get_post_meta($post->ID, $key, true)/10, 1). '</span> / 10'. '</td> Code (markup): Now I have to divide to functions $rate/$count I have this code $count = get_post_meta( $post->ID , 'tie_users_num', true ); if( !empty($rate) && !empty($count)){ $total = (($rate/$count)/5)*100; $totla_users_score = round($rate/$count,2); } Code (markup): and I have try to make this, but didn't work <td align="center" class="sitesrow2 hideme"><span class="featrate">'. (get_post_meta($key="tie_user_rate", true)). round(get_post_meta($post->ID, $key, true)$rate/$count,2). '</span> / 10'. ' Code (markup): Thank you for your help
try change this ... ,true)). round(get_post_meta($post->ID, $key, true)$rate/$count,2). '</span ... PHP: for ... ,true)). round(get_post_meta($post->ID, $key, true) . $rate/$count,2). '</span ... PHP: there is change between get_post_meta() and $rate (dot) but I'm not sure if there has to be only this ... ,true)). $totla_users_score. '</span ... PHP: