File: WIAdmin/WIModule/modules/avg_temp.php

Recommend this page to a friend!
  Classes of Jules Warner  >  WICMS  >  WIAdmin/WIModule/modules/avg_temp.php  >  Download  
File: WIAdmin/WIModule/modules/avg_temp.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: 788 bytes



Class file image Download

include_once 'core/init.php';
if (isset(
$_GET['id'])) {
// Connect to the MySQL database

$id = preg_replace('#[^0-9]#i', '', $_GET['id']);
$sql = mysql_query("SELECT ratings FROM books WHERE id='$id'");
$row = mysql_fetch_array($sql))
$mybooknum = $row["ratings"];
$bookrating = explode(",", $mybooknum);
$count = count($bookrating);
$sum = array_sum($bookrating);
$avg = $sum / $count;
$roundup = floor($avg);
$roundup == 0)
$rating = "This book has not been rated. You can be the first to rate this book.";
    }else if (
$count == 1)
$rating = "Average rating for the book is currently $roundup<b />This book has been rated by $count person.";
$rating = "Sorry, there is an error in the system... Please try refreshing.";


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