How to create an easy Connection using OOP in PHP? Web application development.

    OOP(Object Oriented Programming ) help us to reduce the code, easy to maintenance and reduce the errors,...etc. OOP is used in Java,C++,....
      Today I will show you how create an easy connection using OOP in PHP.
Let go a head,
1/.Create class file: "MyClass.class.php": Then write the code bellow


class database{
 private $con; 
 public function __construct(){
  $this->con=mysqli_connect("localhost","root","","sblog");
  if(!$this->con){
   die("Can not connect to Database server!".mysqli_connect_errno($this->con));
  }
 }
 public function setCon($con){
  $this->con=$con;
 }
 public function getCon(){
  return $this->con;
 }
}
2/.After creating class you need to call it for connection: ->Create an "Index.php" file then write some code to create the new object from MyClass.class.php Before you create new object you need to include class file:



    
      require "myClass.class.php";
      $data=new database;

Full Code

1/.Class: <?php class database{ private $con; public function __construct(){ $this->con=mysqli_connect("localhost","root","","sblog"); if(!$this->con){ die("Can not connect to Database server!".mysqli_connect_errno($this->con)); } } public function setCon($con){ $this->con=$con; } public function getCon(){ return $this->con; } } ?> 2/.Index
<?php 
require "myClass.class.php";
 $data=new database;
?>

How to create SQL Connection to PHP with HeidiSQL?



Welcoem to my blog ,we knew about last PHP v4., in this article we will use PHP v5. so we will use MSQLi because PHP v5 dose not recognize some function of SQL old version.

           Here is the step to do that. What you need to do is to install wamp server or xamp server(up to you)
-Install Wamp Server
-Install Notepad++ (Click Here)
-Heidi SQL: download link


-After you have three important things,you need to create a database in HiediSQL:


->Click on "New"



->Click on "Open"


->Right-Click on Unname(did not name the Folder so it show Unname)
->Create New
->Database
->Create a database name: "Test"
After that i will show you how to code to connect it:

Syntax

    mysqli($db_hostname,$db_username,$db_password,$db_name);

PHP Code

<?php        
 $con=mysqli_connect('localhost','root','','Test');
 if(mysqli_connect_error()){ // Check if it has Error
     die("Can not Connect to Database!".mysqli_connect_errno()); //show Error number
 }
?>


Watch Video here:



How to create a simple website new tutorials? របៀបបង្កើតគេហទំព័រ | upload template for blogger

Hey,guys today i would like to share you how to create simple website with blogspot.

First,you need to go to Blogger.com,then sign in with your gmail account.
After you signed in into blogger you will see "New Blog" button so you just to click it
then it will be pop-up like picture .
   
       Secondly, Just fill all require fields then click on "Create Blog"
When you done it,it will show you :
There is dashboard ,so what you need to do is to upload new template by downloading here
After you have a template you follow me:
1/. Go to "Template"
2/. Click on "Backup/Retore"
3/.Choose you template's file (filename.xml)
4/.Upload
5/.done!

     After that,you need to design website's layout,in order to do that you guys need to watch my video bellow:


How to Install Notepad++ and Emmet Plugin in Khmer

Hi,Today I am so happy to share some technique to you guys. Here is an easy way to install Notepad++ and Emmet Plugin.


Emmet Plugin: Allow you to write your code fast and easier. It will be able to improve HTML and CSS writing in your text Editor.
You might used to know about Emmet plugin for some text editor such as Sublim Text 1,2 .... etc. But Today I will share you guy to install it in Notepad++ .

Here is the steps:

1/. First you need to have Python Script: Download here
2/.You need to download Notepad++
->Go to google then Type: Notepad++
->you will see Download label then go to download it
3/.After you downloaded it,Just double-click on the notepad++ icon
->Choose: English->Next->Agree->Next->Install->Wait a moment to complete it->Finish
4/.Install Emmet Plugin
->Install Python Script(you downloaded)

->Go to menu bar->Show Plugin Manager

->find the word: Emmet->Install


******Watch Video Tutorial here******