File: WIAdmin/WIModule/modules/get_results.php

Recommend this page to a friend!
  Classes of Jules Warner  >  WICMS  >  WIAdmin/WIModule/modules/get_results.php  >  Download  
File: WIAdmin/WIModule/modules/get_results.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: WICMS
Database driven content management system with PDO
Author: By
Last change:
Date: 3 years ago
Size: 622 bytes
 

Contents

Class file image Download
<?php
include_once '../core/init.php';
if(isset(
$_GET['id']))
{
   
$id = preg_replace('#[^0-9]#1', '', $_GET['id']);
}

$sql = mysql_query("SELECT ratings FROM books WHERE id='$id'");
while(
$row = mysql_fetch_array($sql))
{
   
$mynums = $row['ratings'];
   
$expl = explode(",", $mynums);
   
$count = count($expl);
   
$sum = array_sum($expl);
   
$avg = $sum / $count;
   
$roundup = floor($avg);
   
    if(
$roundup == 0)
    {
        echo
"0";
    }else if(
$roundup == 1)
    {
        echo
"1";
    }else if(
$roundup == 2)
    {
        echo
"2";
    }else if(
$roundup == 3)
    {
        echo
"3";
    }else if(
$roundup ==4)
    {
        echo
"4";
    }else if(
$roundup ==5)
    {
        echo
"5";
    }
}

?>


For more information send a message to info at phpclasses dot org.