OOP Script suggestion [on hold]

I have tested the code given below works fine but posting here to know what I am doing is ok or need improvement. Please help me to improve my OOP knowledge


I have parent class file in the same directory


Class pay extends Database {

public $bankname;
public $paymentdate;
public $amount;
public $verify;

public function __construct($id) {
    $this->query("SELECT * FROM ptest WHERE id = ".$id);

    $this->bank = $this->Record['Bank'];
    $this->paymentdate = $this->Record['Date'];
    $this->amount = $this->Record['Amount'];
    $this->verify = $this->Record['Verify'];

function status () {

    $verify = $this->Record['Verify'];

    switch ($verify) {
        case 1:
            $status = "Paid";
            return $status;
        case 2:
            $status = "Invalid Payment";
            return $status;
        case 3:
            $status = "Unknown";
            return $status;     
        case 4:
            $status = "Unpaid";
            return $status;
        case 0:
            $status = "Payment not checked yet";
            return $status;

function bankname () {

    return $this->bank;


function paymentdate () {

    return date('l, F j, Y',strtotime($this->paymentdate));

function amount () {

    return $this->amount;

I used following script to test it works or not

/* output

$paycheck = new pay(400040);

echo $paycheck->amount();
echo $paycheck->bankname();
echo $paycheck->status();
echo $paycheck->paymentdate();

Source: oop

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.