Model-View-Controller is the concept introduced by Smalltalk's inventors to encapsulating some data together with its processing (the model) and isolate it from the manipulation (the controller) and presentation (the view) part that has to be done on a UserInterface.
A model :- is an object representing data e.g. a database table.
A view :- is some form of visualization of the state of the model.
A controller :- offers facilities to change the state of the model.
<?php
//////////////My Property Class////////////
// it contain getter setter function
abstract class EmployeeProperty
{
private $deptid;
public function getDeptId() //Getter
{
return $this->deptid;
}
public function setDeptId($id) //setter
{
$this->deptid=$id;
}
}
//////////My Interface /////////
interface iEmployee
{
function getEmployeeName(EmployeeProperty $objEmployeeProperty);
}
/////////My Data access layer//////
// it fetch data from database server
//it model part of mvc
class DALEmployee implements iEmployee
{
public function getEmployeeName(EmployeeProperty $objEmployeeProperty)
{
$con = mysql_connect("localhost","root","root"); //open connection
if (!$con)
{
die('Could not connect to mysql ' . mysql_error()); // error message
}
else
{
mysql_select_db("test",$con); // select database
$result= mysql_query("select emp_name from employee where deptid=".$objEmployeeProperty-> getDeptId()); // fire query
mysql_close($con); // close connection
}
return $result;
}
}
///////////My business logic layer////////
// it is controller part of mvc
class BALEmployee extends EmployeeProperty
{
public function getEmployeeName(EmployeeProperty $objEmployeeProperty)
{
$objiEmployee=new DALEmployee();
return $objiEmployee->getEmployeeName($objEmployeeProperty);
}
}
?>
/////////////////////My View Part///////////////////////////////////////
New Document
<?php
include("Employee.php");
///////////////My View Part//////////////////
$objBALEmployee=new BALEmployee(); //Create object of business logic layer
$objBALEmployee->setDeptId(1); // Set Property
$result= $objBALEmployee->getEmployeeName($objBALEmployee); // excess bll function
while($row = mysql_fetch_row($result)) // fetch result
{
echo $row[0].""; // display result
}
?>
A model :- is an object representing data e.g. a database table.
A view :- is some form of visualization of the state of the model.
A controller :- offers facilities to change the state of the model.
<?php
//////////////My Property Class////////////
// it contain getter setter function
abstract class EmployeeProperty
{
private $deptid;
public function getDeptId() //Getter
{
return $this->deptid;
}
public function setDeptId($id) //setter
{
$this->deptid=$id;
}
}
//////////My Interface /////////
interface iEmployee
{
function getEmployeeName(EmployeeProperty $objEmployeeProperty);
}
/////////My Data access layer//////
// it fetch data from database server
//it model part of mvc
class DALEmployee implements iEmployee
{
public function getEmployeeName(EmployeeProperty $objEmployeeProperty)
{
$con = mysql_connect("localhost","root","root"); //open connection
if (!$con)
{
die('Could not connect to mysql ' . mysql_error()); // error message
}
else
{
mysql_select_db("test",$con); // select database
$result= mysql_query("select emp_name from employee where deptid=".$objEmployeeProperty-> getDeptId()); // fire query
mysql_close($con); // close connection
}
return $result;
}
}
///////////My business logic layer////////
// it is controller part of mvc
class BALEmployee extends EmployeeProperty
{
public function getEmployeeName(EmployeeProperty $objEmployeeProperty)
{
$objiEmployee=new DALEmployee();
return $objiEmployee->getEmployeeName($objEmployeeProperty);
}
}
?>
/////////////////////My View Part///////////////////////////////////////
New Document
<?php
include("Employee.php");
///////////////My View Part//////////////////
$objBALEmployee=new BALEmployee(); //Create object of business logic layer
$objBALEmployee->setDeptId(1); // Set Property
$result= $objBALEmployee->getEmployeeName($objBALEmployee); // excess bll function
while($row = mysql_fetch_row($result)) // fetch result
{
echo $row[0].""; // display result
}
?>
25 comments:
https://automobilegyanarjan.blogspot.com/2019/04/hardik-pandya-kl-rahul-met-me-and.html
printpallondon.co.uk
printpallondon.co.uk
printpallondon.co.uk
printpallondon.co.uk
printpallondon.co.uk
printpallondon.co.uk
printpallondon.co.uk
printpallondon.co.uk
flashprintinglondon.co.uk
flashprintinglondon.co.uk
flashprintinglondon.co.uk
flashprintinglondon.co.uk
flashprintinglondon.co.uk
flashprintinglondon.co.uk
flashprintinglondon.co.uk
flashprintinglondon.co.uk
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
undefined
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
https://digitalweekday.com/
click & earn
click & earn
click & earn
click & earn
click & earn
click & earn
click & earn
click & earn
pengeairporttransfer
pengeairporttransfer
pengeairporttransfer
pengeairporttransfer
pengeairporttransfer
pengeairporttransfer
pengeairporttransfer
pengeairporttransfer
pengeairporttransfer
click here
click here
click here
click here
click here
Sexy Baccarat Apply for Baccarat UFABET entrance to play Sexy baccarat. Fire systems are also becoming more popular since they do not require the player to spend too much time looking through the cards to try to find that one card that will bring about the winning hand. As the saying goes, "sticks and stones may break my bones, but fire systems can never harm me." However, when it comes to เซ็กซี่บาคาร่า, having more than one type of strategy is not advisable. This is because you risk confusing your decision-making process, leading you to make mistakes that may cost you more than what you expect.
Diane Flores
marydellinger
Scott Dowling
SydneyWinfield
OTIS ALLEY
Sydney Winfield
Sydney Winfield
Sydney Winfield
Cynthia S. Osburn
winfield
Thanks for this valuable post, i loved it!
click here
click here
click here
click here
click here
click here
I loved it, you definitely know what you are doing, keep up the good work!
click here
click here
click here
click here
click here
click here
click here
click here
click here
I loved it, you definitely know what you are doing, keep up the good work!
click here
click here
click here
click here
click here
click here
click here
click here
click here
davetiye
davetiye
davetiye
davetiye
davetiye
davetiye
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
links
In common usage and health, health, according to the World Health Organization, is "a state of complete physical, mental and social well-being and not merely the absence of disease and infirmity". A variety of definitions have been used for different purposes over time.
The Lion Diet Meal Plan has gained attention as a unique approach to nutrition inspired by the eating habits of one of nature's most majestic predators. Emulating the dietary patterns of lions, this meal plan emphasizes simplicity and a focus on whole, nutrient-dense foods.
Abbotsford is home to a variety of physiotherapy abbotsford offering a wide range of services tailored to meet the diverse needs of the community. These clinics are equipped with modern facilities and staffed by skilled professionals dedicated to providing personalized care.
Post a Comment