selectAllClass.php

back


<?php

require_once('dbConnect.php');

// Includes the connection class file for further use.

class selectAllClass extends dbConnect{

// This class extends the dbConnect class from the dbConnect.php class file.
// This is needed to access the connection variable for further sql query.

public function selectAllFunction(){

// This is the function which will select all the rows in the database.

$query="select * from oop_table";

// Passing the sql query to the variable $query.

$result=$this->con->query($query);

// In dbConnect.php class file, $con variable is set as an object of the readymade mysqli class.
// query is the fuction of this class which takes the sql query as the argument.

return $result;

// Returns $result

}

}

?>