<?php require_once('../../db.php'); ?>
<?php 
// if isset post
if ( isset($_POST["post_client_id"]) && isset($_POST["status"]) ) {
		
	
	// first look if client already exists!!!
	try {
		$core = Core::getInstance();
		$stmt = $core->dbh->prepare("UPDATE myclients SET status = :status WHERE client_id = :client_id");
		$stmt -> bindParam("status", $_POST["status"], PDO::PARAM_STR);
		$stmt -> bindParam("client_id", $_POST["post_client_id"], PDO::PARAM_INT);
		$stmt -> execute();
		$row_count = $stmt -> rowCount();
		$row = $stmt -> fetch();
		
		if ($row_count > 0) {
			echo "true";
		} else if ($row_count == 0) {
			echo "false";
		} else {
			echo "There has been an errror";
		}
		
		
	} catch(PDOException $pe) {
		trigger_error('Could not connect to MySQL database. ' . $pe->getMessage() , E_USER_ERROR);
	}
	
}
?>