Wednesday, November 17, 2010

Switch Structure

Example :
if ($i == 0) {
echo "i equals 0";
} elseif ($i == 1) {
echo "i equals 1";
} elseif ($i == 2) {
echo "i equals 2";
}

switch ($i) {
case 0:
echo "i equals 0";
break;
case 1:
echo "i equals 1";
break;
case 2:
echo "i equals 2";
break;
}
Display :

i equals 0i equals 0

Monday, November 15, 2010

While loop

Example :
<?php
$i=1;
while ($i<=11)
{
    echo "$i<br>";
    $i=$i + 2;
}

?>
Display :

1
3
5
7
9
11

If....Else Conditional

Example :
$number = 3;

if ( $number == 3 ) {
echo "The if statement evaluated to true";
} else {
echo "The if statement evaluated to false";
}

Display :

The if statement evaluated to true

If Statement

Example :
$my_name = "candra";

if ( $my_name == "candra" )
{
echo "Your name is candra!";
}
echo "Welcome to my homepage!";
Display :

Your name is candra!
Welcome to my homepage!

Introduction Php

PHP is a script that integrates with HTML and are on the server (server-side HTML embedded scripting).With PHP you can create a variety of web-based applications, ranging from simple web pages to complex applications that require a connection to the database.
Until now have many databases that have been supported by PHP and will likely continue to grow. Database are:

    
* DBase
    
* DBM
    
* FilePro
    
* MySQL (this is a free download)
    
* ODBC
    
* Oracle
    
* Postgres
    
* Sybase
    
* Velocis