<html>
<head>
<title>
128 Concepts EZ Shopper
</title>
</head>
<body>
<?php
/***************************************************************************
 *			create_table9.php	                           *
 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~	                   *
 *   File Info:		  Create rating table                              *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/
include("./config.php");
include("./header.inc");
?>
<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><hr>
<?php

// User defined fields --- u can amend //

$fields="3";
$name[0] = "pid";
$name[1] = "item";
$name[2] = "rating";
$type[0] = "int";
$type[1] = "char";
$type[2] = "int";
$size[0] = "";
$size[1] = "50";
$size[2] = "";

// -------------------------------------------- //
$table = "rating";
$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 = "create table $table (";
for ($i=0;$i<count($name);$i++)
{
	$sql.="$name[$i] $type[$i]";
             if (($type[$i] == "char") or ($type[$i] == "varchar") or ($type[$i] == "timestamp"))
             {
		if ($size[$i] !="") { $sql.="($size[$i])"; }
            }
	if (($i+1) != count($name) )	{ $sql.= ",";}
} $sql.= ")";
echo("SQL COMMAND: $sql <hr>");
$result=mysql_query($sql,$conn)
	or die("Unable to excute the SQL query!!! Possibly SQL command already executed");
if($result)
{
	echo("<br><br>RESULT: RATING has been created..."); 
echo "<br><br><br>";
}

//-------------------------------------------------//

include("./your-footer.inc");
?>
</body>
</html>