<?php 

include("db_connection.php");
$Mainclass=new DB_Controller();
$collection_name = $Mainclass->real_escapes($_REQUEST['collection_name']);
$SLN= $Mainclass->real_escapes($_REQUEST['SLN']);


$active = "Yes";
$datetime = date('Y-m-d H:i:s');

$num_check_sql=$Mainclass->dbh->prepare("SELECT SLN FROM gold_collection_master WHERE collection_name=? and active=? and SLN!=?"); 
$num_check_sql->bind_param("ssi",$collection_name,$active,$SLN);
$num_check_sql->execute();
$num_check_qry=$num_check_sql->get_result();
$collection_check=$num_check_qry->num_rows;

if($collection_check ==0){
	
$insert_sql=$Mainclass->dbh->prepare("UPDATE gold_collection_master SET collection_name=?,last_updated_on=? WHERE SLN=?");
$insert_sql->bind_param("ssi",$collection_name,$datetime,$SLN);
$insert_sql->execute();
$insert_sql->close();	

}


else{

echo 1;

}

$num_check_sql->close();

?>