PHP Classes

File: example1b.php

Recommend this page to a friend!
  Classes of Manish Khanchandani   Reviews   example1b.php   Download  
File: example1b.php
Role: Example script
Content type: text/plain
Description: Example
Class: Reviews
Store and retrieve reviews of products in MySQL
Author: By
Last change:
Date: 14 years ago
Size: 1,913 bytes
 

Contents

Class file image Download
<?php
try {
   
// including rating class
   
include_once('Xoriant_Reviews.php');
   
$Reviews = new Xoriant_Reviews();
   
$itemReviews = $Reviews->showReviews($_GET['item_id']);
   
$itemRating = $Reviews->showRating($_GET['item_id']);
} catch (
exception $e) {
   
$errorMessage = $e->getMessage();
   
$message = $errorMessage;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Items</title>
</head>

<body>
<h1>Item Number: <?php echo $_GET['item_id']; ?></h1>
<p>Description: blah blah</p>
<p><strong>Average Rating:</strong> <?php echo $itemRating['avg_rating']; ?>, <strong>Total Votes:</strong> <?php echo $itemRating['counter']; ?></p>
<p><a href="example1b_add.php?item_id=<?php echo $_GET['item_id']; ?>">Add New Review</a> | <a href="example1.php">Back</a> </p>
<h3>Reviews For Item <?php echo $_GET['item_id']; ?></h3>
<hr />
<?php
if($itemReviews['fields']) {
    foreach(
$itemReviews['fields'] as $k=>$v) {
       
?>
<h3><?php echo $v['review_title']; ?></h3>
<p><?php echo nl2br($v['review_description']); ?></p>
<p>Submitted On: <?php echo $v['rating_date']; ?></p>
Do you agree with this ? <a href="example1b_confirm.php?item_id=<?php echo $_GET['item_id']; ?>&rating_id=<?php echo $v['rating_id']; ?>&confirm=1">Yes</a> | <a href="example1b_confirm.php?item_id=<?php echo $_GET['item_id']; ?>&rating_id=<?php echo $v['rating_id']; ?>&confirm=0">No</a><br />
        <?php
       
if($itemReviews['confirm'][$k]) {
            echo
$itemReviews['confirm'][$k]['total']." agree with this review and ".($itemReviews['confirm'][$k]['counter']-$itemReviews['confirm'][$k]['total'])." does not agree with this review.";
        } else {
            echo
"No one has confirmed for this review.";
        }
        echo
"<br>";
       
?>
<?php
   
}
}
?>
</body>
</html>