<?php
include 'conexion.php';
//echo $_POST['dato'];

$sql = 'SELECT * FROM Inicial WHERE CV_CCT LIKE "' . $_POST['dato'] . '" OR NOMBRECT LIKE "' . $_POST['dato'] . '"';
$result = $conn->query($sql);

if ($result->num_rows > 0) {
	echo "1";
} else {
	$sql = 'SELECT * FROM Preescolar WHERE CV_CCT LIKE "' . $_POST['dato'] . '" OR NOMBRECT LIKE "' . $_POST['dato'] . '"';
	$result = $conn->query($sql);

	if ($result->num_rows > 0) {
		echo "1";
	} else {
		$sql = 'SELECT * FROM Primaria WHERE CV_CCT LIKE "' . $_POST['dato'] . '" OR NOMBRECT LIKE "' . $_POST['dato'] . '"';
		$result = $conn->query($sql);

		if ($result->num_rows > 0) {
			echo "1";
		} else {
			$sql = 'SELECT * FROM Secundaria WHERE CV_CCT LIKE "' . $_POST['dato'] . '" OR NOMBRECT LIKE "' . $_POST['dato'] . '"';
			$result = $conn->query($sql);

			if ($result->num_rows > 0) {
				echo "1";
			} else {
				$sql = 'SELECT * FROM Media WHERE CV_CCT LIKE "' . $_POST['dato'] . '" OR NOMBRECT LIKE "' . $_POST['dato'] . '"';
				$result = $conn->query($sql);

				if ($result->num_rows > 0) {
					echo "1";
				} else {
					$sql = 'SELECT * FROM Superior WHERE CV_CCT LIKE "' . $_POST['dato'] . '" OR NOMBRECT LIKE "' . $_POST['dato'] . '"';
					$result = $conn->query($sql);

					if ($result->num_rows > 0) {
						echo "1";
					} else {
						echo "0";
					}
				}
			}
		}
	}
}
$conn->close();