<?php

session_start();

if($_SESSION['dbName']==""){
header("location:../index.php");
}

include("config.inc.php");
include("function.inc.php");

$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");

if($mainaction=='insert'){

	$query_attributesdt="insert into itemsparamdt(itemparam_id,itemparam_code,itemparam_value)
						values('".$itemparam_id."','".$attributedt_code."','".$attributedt_name."')";
	$result_attributesdt=mysql_query($query_attributesdt,$connection);
	$message= mysql_error();
}

if($mainaction=='edit'){

	$query_attributesdt="update itemsparamdt set itemparam_code='".$attributedt_code."',
												itemparam_value='".$attributedt_name."'
						where itemparamdt_id='".$itemparamdt_id."'";
	$result_attributesdt=mysql_query($query_attributesdt,$connection);
	$message= mysql_error();
}

if($mainaction=='delete'){

	$query_delete="delete from itemsparamdt where itemparamdt_id='".$itemparamdt_id."'";
	$result_delete=mysql_query($query_delete,$connection);
	$message= mysql_error();
}

$message = ereg_replace(" ", "%20", $message);

header ("Location: ./Form_Attributes_Values.php?itemparam_id=".$itemparam_id."&message=".$message);
	
mysql_close($connection);

?>