<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Viewing Records</TITLE>
</HEAD>
<BODY>

<?php
/***************************************************************************
 *			upd_review.php                                     *
 *                     	          				           * 
 *   File Info:		  Updating Reviews                                 *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/
include ("./header.inc");
?>
<img src=images/line.gif border=0 width=100% height=1><br><br>
<center><img src=images/computer.gif border=0><font face=verdana size=3 color=darkred> Viewing Records from REVIEWS table / Updating Record</font></center><br>
<center>
<table width="500" border=1><tr align="justify" class="subtitle"><td>
  <p align="center">
  <img border="0" src="images/database.GIF" width="24" height="24"><font face=Verdana size=1><a href="./create_db.php">Create database</a>&nbsp;
  <img border="0" src="images/database.GIF" width="24" height="24"></font><a href="./delete_db.php"><font face=Verdana size=1>Delete database</font></a><font face="Verdana" size="1">&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24"><a href="./create_menu.php">Create table</a>&nbsp;&nbsp;&nbsp;&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24">&nbsp;
  </font> <a href="./add_menu.php"><font face=Verdana size=1>Add Record </font></a>  
  </p>
  <p align="center">&nbsp;<font face="Verdana" size="1"><img border="0" src="images/Records.GIF" width="24" height="24"></font><a href="./view_menu.php"><font face=verdana size=1>View Records</font></a>&nbsp;
  <font face="Verdana" size="1">&nbsp;&nbsp;&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24"></font><a href="./del_menu.php"><font face=verdana size=1>Delete Record</font></a>
  <font face="Verdana" size="1">&nbsp;&nbsp;&nbsp;
  <img border="0" src="images/Records.GIF" width="24" height="24"></font> <a href="./upd_menu.php"><font face=verdana size=1>Update Record</font></a>&nbsp;
  <img border="0" src="images/home-to.GIF" width="24" height="24"><font face=verdana size=1>&nbsp; <a href="./index.php">Home</a></font>  </a></td></tr></table><br></center>
<?php
include("./config.php");
$table = "reviews";
$conn = @mysql_connect($server,$user,$password)
	or die("Unable to connect to SQL database...");
$rs = @mysql_select_db($database,$conn) 
	or die("Unable to select the database...Please press 'Create Database' to create new database.");
$sql = " SELECT * from $table order by pid";
$rs = mysql_query($sql,$conn)
	or die("Could not execute SQL query!!! Possibly SQL query already been executed.");

$done = "FALSE";
$list="<img src=images/line.gif border=0 width=100% height=1>";
while($row = mysql_fetch_array($rs))
{
	$pid = $row["pid"];
	$pitem = $row["pitem"];
	$rating = $row["rating"];
	$title = $row["title"];
	$review = $row["review"];
	$dispname = $row["dispname"];
	$location = $row["location"];
	$date_added = $row["date_added"];
	$list.="<font face=verdana size=2>Product ID:</font>$pid<br><font face=verdana size=2>Product Item: </font> $pitem";
	$list.="<br><font face=verdana size=2>Rating: $rating</font><br><font face=verdana size=2>Title: </font> $title";
	$list.="<br><font face=verdana size=2>Review: </font> $review";
	$list.="<br><font face=verdana size=2>Author: </font> $dispname<font face=verdana size=2><br>Location: </font> $location";
	$list.="<br><font face=verdana size=2>Date: </font> $date_added<img src=images/line.gif border=0 width=100% height=1><br>";
	$done = "OK";
	
}
$list.="<br><br>";
echo $list;
if ($done == "FALSE")
{
	echo "<center><img src=images/line.gif border=0 width=400 height=1><br><font face=verdana size=2>Opps...There are no customer reviews saved in the database!</font><br><img src=images/line.gif border=0 width=400 height=1><br><br>";
}
$form = "<table border = 1 width = 200><form action =upd_reviews.php method = post>";
$form.="<tr><td>Product ID:</td><td>  <input type = text name = pid value=$pid></td></tr>";
$form.="<tr><td>Author:</td><td> <input type = text name = dispname value=$dispname></td></tr>";
$form.="<input type = hidden name = pitem value = $pitem><input type = hidden name = title value =$title><input type = hidden name = review value = $review>";
$form.="<tr><td><input type = submit value = 'Update Review'></td></tr></table><br>";
echo $form; 
echo "<font face=verdana size=2 color=navy>Please input the author and product id of review you wish to update:-</font><br>";
include("./your-footer.inc")
?>

</BODY>
</HTML>