PHP Classes

File: WIAdmin/WIModule/modules/rate2.php

Recommend this page to a friend!
  Classes of Jules Warner  >  WICMS  >  WIAdmin/WIModule/modules/rate2.php  >  Download  
File: WIAdmin/WIModule/modules/rate2.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: 5 years ago
Size: 771 bytes


Class file image Download

require_once 'core/init.php';

$book = $_POST['book'];
$post_rating = $_POST['rating'];

$find_current_rating = mysql_query("SELECT * FROM book_ratings WHERE book='$book'");

$row = mysql_fetch_assoc($find_data))
$id = $row['id'];
$current_rating = $row['rating'];
$current_hits = $row['hits'];
$comment = $row['comment'];


$new_hits = $current_hits + 1;
$update_hits = mysql_query("UPDATE book_ratings SET hits = '$new_hits' WHERE id='$id'");

$pre_rating = $current_rating + $post_rating;
$new_rating = $pre_rating / $new_hits ;

$update_rating = mysql_query("UPDATE book_ratings SET rating ='$new_rating' WHERE id='$id'");

<!doctype html>
<meta charset="utf-8">
<title>Untitled Document</title>


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