You are on page 1of 21

PHP Day 09

http://www.php.net http://www.mysql.com

Geshan Manandhar
Developer,
Young Innovations Private Limited
www.geshanmanandhar.com
GeshanManandhar.com 1
Classes and Objects
► Objects mirror real life objects.
► OO programming focuses on what and how
of programming rather that just how.
► Classes are the blueprint and
objects/instance are the implementation of
the classes.
► They help us to code programs as we
function in real life.
GeshanManandhar.com 2
A simple person class
<?php
class person {

public $name; //public by default


public $height;
private $pinn_number;

function __construct($persons_name) {
//constructor
$this->name = $persons_name;
}

function set_name($new_name) {
$this->name = $new_name;
}
//contd…
GeshanManandhar.com 3
Person Class contd.
public function get_name() {
return $this->name;
}

function set_pinn_number($new_pinn){
$this->pinn_number = $new_pinn;
}

function get_pinn_number(){
return $this->pinn_number;
}
}

?>

GeshanManandhar.com 4
Instance/object of person class
<?php include("class_person.php"); ?>
<html>
<head>
<title>PHP Class Implementation</title>
</head>

<body>

<?php
$ram = new person("Ram Krishna Maharjan");
$shyam = new person("Shayam Prashad Karki");

$ram->set_name("Ram Kumar Maharjan");


$shyam->set_name("Shyam Karki");

print "Ram's full name: " . $ram->get_name();


print "<br>Shyam's full name: " . $shyam->get_name();

?> More at http://www.killerphp.com/tutorials/object-oriented-php/

GeshanManandhar.com 5
Register at 000Webhost
► Register at 000webhost.com.
► Wait for the triggered email.

GeshanManandhar.com 6
Registration at 000Webhost

GeshanManandhar.com 7
Cpanel at 000webshot

GeshanManandhar.com 8
File Manger

GeshanManandhar.com 9
Uploaded files form net2ftp

GeshanManandhar.com 10
Or use a FTP Client
► Fireftp is a add on to Firefox, download at
https://addons.mozilla.org/en-
US/firefox/addon/684
► FileZilla is a free FTP, download at
http://filezilla-project.org/download.php?
type=client
► There are other FTP clients as well
► I recommend above two as they are free.

GeshanManandhar.com 11
FireFTP

GeshanManandhar.com 12
Fire FTP In action

GeshanManandhar.com 13
FileZilla

GeshanManandhar.com 14
MYSQL Database creation

GeshanManandhar.com 15
MYSQL database created

GeshanManandhar.com 16
PHPMyAdmin of 000webhost

GeshanManandhar.com 17
Now edit your connection file
► Edit your connection.php or conn_db.php file to
suit the setting as provided in the registration.

GeshanManandhar.com 18
Access to your website
► http://your-registered-name.net23.net
► Or your .com.np.

GeshanManandhar.com 19
Questions

GeshanManandhar.com 20
Get Started register
► Registerat 000webhost.com
► Upload your files, test them on a live web
server.

GeshanManandhar.com 21

You might also like