Thursday 7 March 2013

Introduction To PHP......



PHP

Description:-
      Morph Technologies is providing the six month training in PHP. Various fields of php are included .Website development, other applications etc.
Body:
PHP is a server-side scripting language, especially suited for the creation of dynamic web pages. This programming language offers web developers a large selection of instruments. PHP, which has become the basis for many web applications, allows easy insertion in HTML code and connection to MySQL and PgSQL Databases.PHP was created in 1995 by Rasmus Lerdorf and means Personal Home Page language. Ever since its beginning it has been one of the most intuitive programming languages used for the creation of dynamic web pages. Later, when the PHP team was formed, the parser was rewritten and PHP version 3.0 saw the light of day. The PHP 3 version was the first serious improvement of the PHP language, which fixed a lot of bugs and completely redesigned the PHP core. The meaning of the abbreviation was also changed to PHP Hypertext Preprocessor.
What is PHP?
  1. PHP stands for PHP: Personal Home page.
  2. As we said before it is a server-side scripting language.
  3. t is free and is an open source software product.
  4. The PHP scripts are executed on the server.
  5. PHP supports many databases (MySQL, Sybase, Oracle and many others.)
  6. PHP runs on different platforms (Unix, Linux, Windows.)
  7. PHP is compatible with almost all web-servers used today (Apache, IIS, etc.)
  8. A PHP file can contain plain text, HTML tags and scripts
  9. The PHP files can have one of the following extensions: php, php3 or phtml.

Before you can follow the coming PHP tutorials you need to have the following:
  • Access to a web server (like Apache)
  • PHP and MySQL should be installed on the web server.
The easiest way is to find a cheap web hosting plan that support PHP and MySQL (most of the web-hosting providers do.) For a couple of bucks a month you can get a virtual host. The advantage is that everything is already installed and that you can share your program (that you are going to write) with the rest of the world.
If you don’t want to spend money, you can also install everything on your local machine. The easiest way is to install WAMP if you have a Windows machine and LAMP if you have a Linux machine. (WAMP = Windows Apache MySQL PHP and LAMP = Linux Apache MySQL PHP.) These packages install everything you need. Read the install manual of these packages for instructions. After installation you should have access to http://localhost in your browser.

 

The essentials for learning PHP:

Learning a new language (programming or otherwise) can be a bit overwhelming. Many people just don't know where to start and give up before they even begin. Learning PHP is NOT as overwhelming as it might seem, I promise you. Just take it one step at a time, and before you know it you'll be off and running.

1.) Basic Knowledge:

The first thing you need, before you start learning PHP, is a basic understanding of HTML. You can switch between PHP and HTML right in the same document. You can even run PHP from an HTML file.

2.) Tools:

When creating PHP pages, you can use the same program you use to create your HTML pages. Any plain text editor will do. You will also need an FTP client to transfer files from your computer to your web hosting. If you already have an HTML website you most likely already use an FTP program.

3.) The Basics:

Now you can finally get started learning PHP! The first thing you should read is our PHP Basics tutorial. This will take you through creating y



How To install PHP?



                         How  To Install  PHP
To start using PHP, you can:
  • Find a web host with PHP and MySQL support
  • Install a web server on your own PC, and then install PHP and MySQL.

However, if your server does not support PHP, you must:
  • install a web server
  • install PHP
  • install a database, such as MySQL.
                 How To create connection with database
Following code is used to create the connection with database:-
<? php
// Create connection
$con=mysqli_connect ("example.com","peter","abc123","my_db");

// Check connection
if (mysqli_connect_errno($con))
  {a
  echo "Failed to connect to MySQL: " . mysqli_connect_error ();
  }
?>

How to Close a connection
Following code is used to close a connection:-
<?php
$con=mysqli_connect("example.com","peter","abc123","my_db");

// Check connection
if (mysqli_connect_errno($con))
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
mysql_close($con);
?>
How to create a Database
To create a Database following code is written:-
<?php
$con=mysqli_connect("example.com","peter","abc123");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

// Create database
$sql="CREATE DATABASE my_db";
if (mysqli_query($con,$sql))
  {
  echo "Database my_db created successfully";
  }
else
  {
  echo "Error creating database: " . mysqli_error();
  }
?>