Tuesday, August 9, 2022
HomeWordPress DevelopmentShow the quantity 0 to the place of nan

Show the quantity 0 to the place of nan


that is my code

<?php
    $sql = $wpdb->put together( " SELECT meta_value FROM {$wpdb->prefix}commentmeta INNER JOIN {$wpdb->prefix}feedback ON {$wpdb->prefix}commentmeta.comment_id = {$wpdb->prefix}feedback.comment_ID WHERE comment_post_ID = %d AND meta_key = 'score' ", get_the_ID() ); $outcomes = $wpdb->get_results( $sql );
    foreach($outcomes as $outcome){
        $price = $result->meta_value;
        $sum +=$price;
    }
    $res = $sum/rely ($outcomes);
    $res = number_format((float)$res,1,'.','');
    ?>

That is the output

<?php echo $res ?>
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments