(sorry for my bad english)
I would like to use Object-Oriented Programming in PHP5 and so i have written some code.
It is a simple page that shows a .swf(video with flash)
I have created a class ConnectionDB that has a method to connect connect_DB() and has a method get_connectionDB() which get back the connection; in the method __destruct of this class i close my connection. The ConnectionDB class has also some fields as db_user, db_password ecc.
Then i have created another class, Video with this fields:
$id_video
$name_video
and these methods
_construct ($id){
puts $id in field $id_video
}
getVideo(ConnectionD😎{
make a select(using $id_video in the where condition) from DB to get the name of the file .swf and puts this name in field $name_video
}
showVideo(){
the file .swf is shown by html code echo("...$name_video...");
}
my page php is this:
<?php
$id=...get from the url the file's id
$connection_1 = new ConnectionDB();
$my_connection=$connection_1->get_connectionDB() //j use an object of class ConnectionDB to have $my_connection
$my_video = new Video($id);
$my_video->getVideo($connection_1);
$my_video->showVideo();
?>
is it good???
thanks and sorry for my bad english