Wednesday, 17 October 2018

Database Functions Init: MYSQLI CRUD OOP Series

This article is a continuation to Database Class article which extends the functionality of the DBClass and perform OOP concept of inheritance.

Step 2. Create Class for Database Functions
This will extend the class DBconn to implement OOP inheritance and allow the user to store, retrieve and update data from database.

Filename: class.dbfunctions.php
Code:

<?php
include 'class.db.php';
class DBfunctions extends DBconn
{
public function testing(){
echo "testing";
}
}
$dbopt = new DBfunctions();
$test = $dbopt->testing();
print_r($test);
?>

Discussion:
public function testing will try to test the database connection commands written in class.db.php
The code below creates a new instance of the class itself.
print_r($test) displays data from an array type variable.

0 comments:

Post a Comment

If possible, leave a positive comment. No hate speech or elicit comments. Thank you.