<?php
class ScholarshipMgmt
{
	public $scholarship_id;
	public $scholarship_name;

	function getAllRecords($limit = 0, $start = 0, $condition = "", $order_field = "", $order_type = "")
	{
		$qry = "";
		$qry = "SELECT * FROM scholarship_master";

		if ($condition != "") {
			$qry .= $condition;
		}

		if ($order_field != "" && $order_type != "") {
			$qry .= " order by $order_field $order_type";
		}

		if (intval($limit) > 0 && intval($start) >= 0) {
			$qry .= " Limit $start , $limit";
		}

		$out = dbQuery($qry);

		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}


	function addscholarship()
	{
		$Qry1 = "";
		$Qry1 .= "scholarship_name='" . Escape($this->scholarship_name) . "',";


		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "insert into scholarship_master set " . $Qry1 . " ";
			//    echo $qry; exit;
			dbQuery($qry);
			$this->lec_id = dbInsertedId();
		}
	}

	function editscholarship()
	{
		$Qry1 = "";
		$Qry1 .= "scholarship_name='" . Escape($this->scholarship_name) . "',";


		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "update scholarship_master set " . $Qry1 . " where scholarship_id=" . $this->scholarship_id;
			dbQuery($qry);
		}
	}

	function deletescholarship()
	{
		$qry = "delete from scholarship_master where scholarship_id in (" . $this->scholarship_id . ") ";
		dbQuery($qry);
	}

}
?>