What is Data Access Object Model in PHP ORM Architecture

Program 1

<?php 
 class MyConnection
 {
       public function getConnection()
       {
            $mycon=mysqli_connect("localhost","root","","Library") or die("Connection not success");
            return $mycon;
       }
 }
?>

Program 2

<?php 
 require 'dao.php';
  require 'model.php';
?> 
<html><head><title>This is test page of connection</title></head>
<body>
<center>
<?php 
       
     $S=new Student();
     $S->setrno(1002);
     $S->setname('Nilesh');
     $S->setphy(96);
     $S->setchem(96);
     $S->setmath(96);

      $d=new StudentDAO();
      $d->insertStudent($S);
    
    

?> 
</center>
<body>

Program 3

<?php 
    class Student
    {
        private $rno;
        private $name;
        private $phy;
        private $chem;
        private $math;

        public function setrno($rno)  
        {
            $this->rno=$rno;
        }
        public function getrno()
        {
            return $this->rno;
        }
        public function setname($name)  
        {
            $this->name=$name;
        }
        public function getname()
        {
            return $this->name;
        }

        public function setphy($phy)  
        {
            $this->phy=$phy;
        }
        public function getphy()
        {
            return $this->phy;
        }
        public function setchem($chem)  
        {
            $this->chem=$chem;
        }
        public function getchem()
        {
            return $this->chem;
        }
        public function setmath($math)  
        {
            $this->math=$math;
        }
        public  function getmath()
        {
            return $this->math;
        }

    }
?>
courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

Your email address will not be published. Required fields are marked *