Login   Register  
PHP Classes
elePHPant
Icontem

File: example1a.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Manish Khanchandani  >  Reviews  >  example1a.php  >  Download  
File: example1a.php
Role: Example script
Content type: text/plain
Description: Example
Class: Reviews
Store and retrieve reviews of products in MySQL
Author: By
Last change: changed role
Date: 2009-07-20 06:06
Size: 1,339 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="example1a_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>    
        <?php
    
}
}
?>
</body>
</html>