0
    <?php
include_once 'connectClass.php';

class manageSchool extends connect
{

    public function registerSchool($Name,$Address,$City,$State,$PinCode,$Email,$PassWord,$Website,$Phone1,$Phone2,$Fax,$Type,$ClassesUpto,$PrincipalName,$ClassTeacher){
        try{
        $statement=$this->db->prepare("INSERT INTO `tbl_school`(`Name`, `Address`, `City`, `State`, `PinCode`, `Email`,`PassWord`,
         `Website`, `Phone1`, `Phone2`, `Fax`, `Type`, `ClassesUpto`, `PrincipalName`, `ClassTeacher`)
          VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
        $statement->execute(array($Name,$Address,$City,$State,$PinCode,$Email,$PassWord,$Website,$Phone1,$Phone2,$Fax,$Type,$ClassesUpto,$PrincipalName,$ClassTeacher));

    }catch (Exception $e) {
            echo 'Query failed'.$e->getMessage();

        }
    }
}

This is sample of code which I used to access PDO object from the connection class. I have to use extends every time for a new class that is created. Is there any other proper method to achieve this?. I have seen some of the answers for the same in stackoverflow but couldn't understood it well.

Krishnadas PC
  • 3,966
  • 34
  • 33

0 Answers0