<?php
	//Connects to your Database
	include "../db_connection/db_connection.php";
	include "../config/config.php";	
	
	$cat_name		=	$_POST['cat_name']; 
	$stn_nam		=	$_POST['stn_nam']; 
	$stn_wght		=	$_POST['stn_wght'];
	
	$SLCT_comp = "SELECT * FROM mas_stone_type WHERE mas_stone_cat_id='$cat_name' and stone_name='$stn_nam' and stone_weight='$stn_wght'";
	$QURY_comp = mysqli_query($connect,$SLCT_comp);
	$res_comp = mysqli_num_rows($QURY_comp);
	if($res_comp==0){
	$INSRT		= "INSERT INTO mas_stone_type(`mas_stone_cat_id`,`stone_name`,`stone_weight`, `post_dt`) VALUES ('$cat_name','$stn_nam','$stn_wght','$cur_time')";
	//echo $INSRT;
	$QURY = mysqli_query($connect,$INSRT);			
?>
	<script type="text/javascript">
		alert("Data inserted successfully");
		//history.back();
		window.location='../master_stone_list.php';
	</script>
	<?php } else { ?>
		<script type="text/javascript">
		alert("Already Exists!!!");
		//history.back();
		window.location='../master_stone_add.php';
	</script>

	<?php } ?>
