<html>
<head>
<title>EZ Shopper - Upgrade Script for adding category pictures</title>
</head>
<body>
<?php
/***************************************************************************
 *			upgrade.php                        	           *
 *                     	          				           *
 *   File Info:		  EZ Shopper Upgrade script                        *
 *   Copyright:       Copyright 2003 http://www.128concepts.com            *
 *						                           *
 ***************************************************************************/

include_once("./header.inc");
include_once("./config.php");

echo "<center><img src=images/computer1.gif border=0><h3> Upgrade EZ Shopper to accept input, editing of category pictures</h3></center><hr width=400>";

$table = "category";
$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 = "alter table $table add cpic char(128)";
$result = @mysql_query($sql,$conn);

if (!$result)
{
	echo"<center>Seems that your sql database has already been updated.....<center>";
	echo "<hr width=400>";
	include_once("./footer.inc");
	exit();
}

if ($result)
{
	$sqls = "update $table set cpic = './images/folder.gif'";
	$results = @mysql_query($sqls,$conn);
	if ($results)
	{
		echo "<center>Successfully added extra picture category into sql database. Also set category pictures to default picture.<br>This file is no longer needed and should be deleted from your store directory.</center>";
	}
	else
	{
		echo"<center>No action taken....seems that your sql database has already been updated...</center>";
		echo "<hr width=400>";
		include_once("./footer.inc");
		exit();
	}
}
	
echo "<hr>";
include_once("./footer.inc");
?>
</body>
</html>
