• My PHP Pages

    This is a complete and free PHP programming course for beginners. Everything you need to get started is set out in section one below.

  • My PHP Pages

    This is a complete and free PHP programming course for beginners. Everything you need to get started is set out in section one below.

  • My PHP Pages

    This is a complete and free PHP programming course for beginners. Everything you need to get started is set out in section one below.

Sep 24, 2013

Posted by Unknown
3 comments | 12:51 AM
you can send emails using PHP. for send emails  we can use mail() php function. look at below example and change variable values to yours. this script is working with gmail too.. $to = 'yourmail@mail.com'; $subject = 'Your Subject Goes Here'; $message = ' Your Mail Body Goes Here... ! '; $headers = "From: " . strip_tags($_POST['req-email']) . "\r\n"; $headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n"; $headers .=...

Read More..

Sep 22, 2013

Posted by Unknown
5 comments | 11:32 PM
                                                      You can use PHP ZIP function to make archives using PHP. I have create a PHP Class to zip all folders and files in a given directory you just need to add source directory and  destination path. Look at the code bellow... Copy bellow code and save it as...

Read More..

Sep 18, 2013

Posted by Unknown
1 comment | 3:05 AM
 For this you basically need two files one is class file and other one is the file that where you calling PDO connection. You can reduce rewriting connection using this OOP PDO script. This class returns after the execution. if connection established successfully it returns '1' else it return error description  Here is the Class. dbuser = $dbuser; $this->dbpass = $dbpass; $this->dbhost = $dbhost; $this->dbname = $dbname; ...

Read More..

Jul 10, 2013

Posted by Unknown
2 comments | 11:52 PM
Inserting data into database is the most common operation. Using PDO this is just two step process. in this article lets see how to inset data using PDO  Bellow is very simple insert code.. lets look at it.. //STH means Statement Handler $STH = $DBH->prepare("INSERT INTO my_table VALUES('my php pages')"); $STH->execute();  This operation can be done using exec() function also. but it is good to use prepare method because it...

Read More..

Jul 9, 2013

Posted by Unknown
No comments | 5:16 AM
PDO can use exceptions and handle errors. Every time when you use PDO it is good to use it with in try catch block. there is three error modes available in PDO and you can set the error mode attribute on your database. Lets look at the code. $DBH->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT ); $DBH->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING ); $DBH->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );...

Read More..

Jul 5, 2013

Posted by Unknown
7 comments | 7:37 AM
Most of the PHP developers using Mysql or Mysqli php functions when they work with databases. but PHP has introduced new extension call PDO in PHP 5.1. this methord is way better and very productive. PDO is stands for PHP Data Objects.  Note : Mysql functions is removed from PHP 5.5. so its better to use PDO or Mysqi. I strongly recommend to use PDO. PDO Supported Databases Drivers List You can use bellow code to find which driver is...

Read More..

Jul 2, 2013

Posted by Unknown
1 comment | 9:34 AM
You can easily update and delete data in mysql tables using php. This update & delete functionality is almost same as insert data. just sql query is difference. Lets look at how to update data. for this you have to use UPDATE sql statement. lets look at the code below. //make connection $con = mysql_connect("localhost","root","123"); //check connection if(!$con) { die('Could not connect to the database:'.mysql_error()); } //select database $db=mysql_select_db("my_database",$con); ...

Read More..

Jul 1, 2013

Posted by Unknown
No comments | 10:13 AM
Today we gonna talk about how to retrieve data from a mysql database. in last three lessons we learned about how to create a connection to database, how to create database & tables and how to insert data. if you have any problem with those things you better read few last post before go through this. ok lets begin. In this case we have to use Sql SELECT statement through mysql_query() function to fetch the data from mysql tables. There is several...

Read More..

Jun 30, 2013

Posted by Unknown
3 comments | 5:55 AM
Today lesson is about how to insert data to mysql table using php mechanisms. In last two lessons we learned about how to make a connection and how to create a database and tables. if you have any problems with those things you better read last posts before go through this. There is no much different between creating table it is just sql string. Lets look at the code. //make connection $con = mysql_connect("localhost","root","123"); //check...

Read More..

Jun 29, 2013

Posted by Unknown
No comments | 5:57 AM
In the last lesson we learned about how to make a connection to mysql database. To create either database or table first we need to make a connection to the database server. Please read last post if you don't know how to create the connection to mysql server. Creating  a Database We have to use new method to execute sql queries. mysql_query(connection,sql query sting) connection- return value of mysql_connect() function Sql query string...

Read More..

Jun 28, 2013

Posted by Unknown
No comments | 8:29 AM
Lets connect mysql database using php. there is some special php functions for this.. mysql_connect(host,username,password) Host - host is optional its host name of mysql database. most of the time its localhost username - mysql username password - mysql password There is a another function to do this. mysqli_connect(host,username,password,dbname) Note : it is mysqli_connect()  this is new method php introduced "i" stands for improvements...

Read More..

Jun 23, 2013

Posted by Unknown
11 comments | 9:45 AM
Today we gonna talk about how to work with radio buttons using php. a sample radio button image is bellow. Lets create a sample HTML code. File name : radio.html <html> <head> <title>radio form</title> </head> <body> <form name="radiobtnform" method="post" action="process.php"> <form name="radiobtnform" method="post" action="process.php"> <label>Gender : </label> <input...

Read More..

Jun 21, 2013

Posted by Unknown
3 comments | 9:43 AM
Today we talk about how to work with forms in PHP.. lets make a simple form using HTML <html> <head> <title>my form</title> </head> <body> <form name="myform" action="" method="post"> <lable> Enter Your Name : </lable> <input type="text" name="name"/> <input type="submit" name="submit_btn" value="Hit on me !"/> </form> <!-- PHP Part begins after this line --> Note-...

Read More..

Jun 20, 2013

Posted by Unknown
No comments | 12:04 AM
Today lession is how to work with PHP arrays. An array is a variable which can store number of values at once <?php $phones = array("nokia","sony","samsung"); echo "Phones : ".$phone[0].",".$phone[1]." and ".$phone[2]; ?> result - Phones : nokia , sony and samsung We can count number of values in the array using count() function. <?php $phones = array("nokia","sony","samsung"); echo "Phones : ".$phone[0].",".$phone[1]." and ".$phone[2]; echo...

Read More..

Jun 17, 2013

Posted by Unknown
No comments | 4:08 AM
PHP also has if else , while , do while and for statements. lets see how to write a simple if else statement. i am not going to talk in depth about this statements  since php statements are same as other programming languages <?php $today =  date_format(date_create(date("y-m-d")), 'l'); echo "Today is : ".$today."<br>"; if ($today != 'sunday' or $today != 'saturday') {  ...

Read More..

Jun 14, 2013

Posted by Unknown
1 comment | 8:45 PM
Variables are use for storing values, like string numbers or arrays. when a variable declared, it can be used over and over again in your script. Note : All Variables in PHP start with a $ sign symbol example : $my_variable = 100; ----------------------------------------------------------------------------------------------------------- PHP is loosely typed language  In PHP, a variable dose not need to be declared before adding a value...

Read More..

Jun 13, 2013

Posted by Unknown
No comments | 11:34 AM
                                                            Video Tutorial in sinhala                             For more sinhala video tutorials visit http://myphpvideo.blogspot.com Comments in PHP    ...

Read More..

Jun 11, 2013

Posted by Unknown
28 comments | 12:08 PM
                                                   Video Tutorial in sinhala                              For more sinhala video tutorials visit http://myphpvideo.blogspot.com How to start coding with PHP Normally we are writing PHP...

Read More..

Posted by Unknown
No comments | 11:56 AM
What You Should Already Know Before you continue you should have a basic understanding of the following: HTML JavaScript If you want to study these subjects first, find the tutorials on our Home page. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use PHP is simple for beginners.PHP also offers...

Read More..

Posted by Unknown
No comments | 11:48 AM
 PHP: Hypertext Preprocesso...

Read More..