What is Php?
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
Example of Php:
<!DOCTYPE html>
<html>
<body>
<?php
echo "My first PHP script!";
?>
</body>
</html>
Php syntax
<?php
.
.
.
?>
Echo & Print Statement Example
<php
echo "Hello World!";
print "Hello World!";
?>
Variable Assign
<?php//String data type
$name = "Asad";
$f_name = "Abdul ahad";
$email = "abc@gmail.com";
$age = "17";
echo "NAME:" . $name ."<br>F_NAME:" . $f_name . "<br>EMAIL:" . $email . "<br>AGE:" . $age;
?>
Two Variable Add
<?php
//Integer data type $a = 5;
$b = 8;
$result = $a+$b;
echo $result;
?>
Array
<?php
$fruits = Array ("APPLE" , "ORANGE" , "BANANA" , "PEACH" , "PINEAPPLE");
echo $fruits[0];
?>
CONNECTION OF DATABASE CODING
<?php
$con = mysql_connect {"localhost ","root",""};
$db = mysql_select_db{'registration_form',con};
$first_name = $_POST{'first_name'};
$last_name = $_POST{'last_name'};
$father_name = $_POST{'father_name'};
$address = $_POST{'address'};
$age = $_POST{'age'};
$email = $_POST{'email'};
$contact = $_POST{'class'};
?>
NOTE:
FIRST WE CREEATE DATABASE ON APACHE SERVER WITH THE HELP OF XAMPP SOFTWARE :
NOW I DESCRIBE HOW WILL WE INSTALL XAMPP SOFTWARE AND THEN HOW WILL CREATE DATABASE....
No comments:
Post a Comment