php oop and mysql
- by gloris
I need to get data, to check and send to db.
Programming with PHP OOP.
Could you tell me if my class structure is good and how dislpay all data?. Thanks
<?php
class Database{
private $DBhost = 'localhost';
private $DBuser = 'root';
private $DBpass = 'root';
private $DBname = 'blog';
public function connect(){
//Connect to mysql db
}
public function select($rows){
//select data from db
}
public function insert($rows){
//Insert data to db
}
public function delete($rows){
//Delete data from db
}
}
class CheckData{
public $number1;
public $number2;
public function __construct(){
$this->number1 = $_POST['number1'];
$this->number2 = $_POST['number2'];
}
function ISempty(){
if(!empty($this->$number1)){
echo "Not Empty";
$data = new Database();
$data->insert($this->$number1);
}
else{
echo "Empty1";
}
if(!empty($this->$number2)){
echo "Not Empty";
$data = new Database();
$data->insert($this->$number2);
}
else{
echo "Empty2";
}
}
}
class DisplayData{
//How print all data?
function DisplayNumber(){
$data = new Database();
$data->select();
}
}
$check = new CheckData();
$check->ISempty();
$display = new DisplayData()
$display->DisplayNumber();
?>