SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Introduction to PHP
•Server-Side Scripting
•MYSQL
•PHP
•Apache
•Variables
•Control Structure
•Looping
A “script” is a collection of program or sequence of
instructions that is interpreted or carried out by
another program rather than by the computer
processor.
Client-side
Server-side
In server-side scripting, (such as PHP, ASP) the script
is processed by the server Like:
Apache, ColdFusion, ISAPI and Microsoft's IIS on
Windows.
Client-side scripting such as JavaScript runs on the
web browser.
 Advantages of Server-Side Scripting

 Dynamic content.
 Computational capability.
 Database and file system access.
 Network access (from the server only).
 Built-in libraries and functions.
 Known platform for execution (as opposed to client-

side, where the platform is uncontrolled.)
 Security improvements
• PHP stands for PHP: Hypertext Preprocessor
• Developed by Rasmus Lerdorf in 1994
• It is a powerful server-side scripting language for

creating dynamic and interactive websites.
• It is an open source software, which is widely
used to develop dynamic websites.
• It is an efficient alternative to competitors such as
Microsoft's ASP.
• PHP is perfectly suited for Web development and

can be embedded directly into the HTML code.
• The PHP syntax is very similar to JavaScript, Perl
and C.
• PHP is often used together with Apache (web
server) on various operating systems. It also
supports ISAPI and can be used with Microsoft's
IIS on Windows.
• PHP supports many databases
(MySQL, Informix, Oracle, Sybase, Solid, Postgre
SQL, Generic ODBC, etc.)
• What is a PHP File?
• PHP files have a file extension of

".php", ".php3", or ".phtml"
• PHP files can contain text, HTML tags and scripts
• PHP files are returned to the browser as plain
HTML
What you need to develop PHP Application:
• Install Apache (or IIS) on your own server, install
PHP, and MySQL
• OR
• Install Wampserver2 (a bundle of
PHP, Apache, and MySql server) on your own
server/machine
• When a PHP document is requested of a

server, the server will send the document first to a
PHP processor
• Two modes of operation
– Copy mode in which plain HTML is copied to the

output
– Interpret mode in which PHP code is interpreted
and the output from that code sent to output
– The client never sees PHP code, only the output
produced by the code
• PHP statements are terminated with semicolons ;
• Curly braces, { } are used to create compound statements
• Variables cannot be defined in a compound statement

unless it is the body of a function
• PHP has typical scripting language characteristics
–
–
–
–

Dynamic typing, un-typed variables
Associative arrays
Pattern matching
Extensive libraries

• Primitives, Operations, Expressions
– Four scalar types: boolean, integer, double, string
– Two compound types: array, object
– Two special types: resource and NULL
• A PHP scripting block always starts with <?php and ends with

?>
<?php ……………. ?>
– Other options are:
1.
<? ……………… ?>
2.
<script> ... </script>

• There are three basic statements to output text with PHP:

echo, print, and printf. Example:
echo 'This is a <b>test</b>!';
• Comments:
– #
– //
– /* . . . */
Basic PHP Syntax
 Inserting external files:
 PHP provides four functions that enable

you to insert code from external files:
include() or require() include_once()
or require_once() functions.
• E.g.
 include("table2.php");
– Included files start in copy mode
Example 1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <title>Simple PHP Example</title>

<body>

<?php
echo "Hello Class of 2011. This is my first PHP Script";
echo "<br />";
print "<b><i>What have you learnt and how many friends have you
made?</i></b>";
echo "<br /><a href='PHP I-BSIC.ppt'>PHP BASIC</a>";

?>
</body>
</html>
PHP Variables
• Variables are used for storing values, such as

numbers, strings or function results, so that they can be
used many times in a script.
• All variables in PHP start with a $ sign symbol.
• Variables are assigned using the assignment operator "="
• Variable names are case sensitive in PHP: $name is not

the same as $NAME or $Name.
• In PHP a variable does not need to be declared before

being set.
• PHP is a Loosely Typed Language.
Strings in PHP
•
•
•

a string is a sequence of letters, symbols, characters and arithmetic values or
combination of all tied together in single or double quotes.
String literals are enclosed in single or double quotes
Example:
<?php
$sum = 20;
echo 'the sum is: $sum';
echo "<br />";
echo "the sum is: $sum";
echo "<br />";
echo '<input type="text" name="first_name" id="first_name">';
?>

–

Double quoted strings have escape sequences (such as /n or /r) interpreted
and variables interpolated (substituted)
– Single quoted strings have neither escape sequence interpretation nor variable
interpolation
– A literal $ sign in a double quoted string must be escaped with a backslash, 
– Double-quoted strings can cover multiple lines
PHP Function
 In php a function is a predefined set of

commands that are carried out when the function
is called.
 The real power of PHP comes from its functions.
 PHP has more than 700 built-in or predefine
functions for you to use.
Using Built-in Function
 Examples: Inserting external files:
 PHP provides four functions that enable you to insert code from external

files: include() or require() include_once() or require_once()
functions.
 A sample include file called add.php
<html> <body>
<?php
function add( $x, $y ) {
return $x + $y; }
?>
<h1>Welcome to my home page</h1>
<p>Some text</p>
</body> </html>

Using the include function
<?php
include('add.php');
echo add(2, 2); ?>
PHP Functions - Adding
parameters
 A parameter is just like a variable.
 The parameters are specified inside the parentheses.

Syntax:
<?php
function function_name(param_1, ...
, param_n)
{
statement_1;
statement_2;
...
statement_m;

?>

}

return return_value;
PHP Functions - Adding
parameters
 Functions can also be used to return values.
Example:



<html>
<body>








<?php
function add($x,$y)
{
$total = $x + $y;
return $total;
}




echo "1 + 16 = " . add(1,16);
?>




</body>
</html>
Control Structure
 Control structures are the building blocks of any

programming language. PHP provides all the
control structures that you may have encountered
anywhere. The syntax is the same as C or Perl.
 Making computers think has always been the
goal of the computer architect and the
programmer. Using control structures computers
can make simple decisions and when
programmed cleverly they can do some complex
things.
PHP Switch Statement
• If you want to select one of many blocks of code to be

executed, use the Switch statement.
• The switch statement is used to avoid long blocks of
if..elseif..else code.
Syntax
switch (expression)
{
case label1: code to be executed if expression = label1;
break;
case label2: code to be executed if expression = label2;
break;
default: code to be executed if expression is different from both
label1 and label2;
}
PHP Switch Statement















switch ($textcolor)
{
case "black":
echo "I'm black";
break;
case "blue":
echo "I'm blue";
break;
case "red":
echo "I'm red";
break;
default: // It must be something else
echo "too bad!!, I'm something else";
}
PHP Looping
• Looping statements in PHP are used to execute the

same block of code a specified number of times.
• In PHP we have the following looping statements:
– while - loops through a block of code if and as long as

a specified condition is true
– do...while - loops through a block of code once, and
then repeats the loop as long as a special condition is
true
– for - loops through a block of code a specified number
of times
– foreach - loops through a block of code for each
element in an array
The while Statement
Syntax
while (condition)
{
// statements

}

Example
<html> <head> <title>Let us count !!!</title></head>
<body>
<?php
$limit = 10;
echo "<h2> Let us count from 1 to $limit </h2><br />";
$count = 1;
while ($count <= $limit)
{
echo "counting $count of $limit <br>";
$count++;
}
?>
</body>
<html>
The do...while Statement
•

The do...while statement will execute a block of code at least once - it
then will repeat the loop as long as a condition is true.

Syntax
• do { code to be executed; } while (condition);









Example
<html> <body>
<?php
$i=0;
do { $i++; echo "The number is " . $i . "<br />"; }
while ($i<5);
?>
</body> </html>
PHP Arrays
 An array can store one or more values in a single

variable name.
 There are three different kind of arrays:
 Numeric array - An array with a numeric ID key
 Associative array - An array where each ID key is

associated with a value
 Multidimensional array - An array containing one
or more arrays
Numeric Array
• A numeric array stores each element with a numeric ID

key.
• There are different ways to create a numeric array:
Example 1
• In this example the ID key is automatically assigned:
• $names = array("Peter","Quagmire","Joe");
Example 2
• In this example we assign the ID key manually:
$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";
Associative Arrays
• Each ID key is associated with a value.
• When storing data about specific named values, a

numerical array is not always the best way to do it.
• There are two ways of creating Associative Array:
Example 1
• $ages =
array("Peter"=>32, "Quagmire"=>30, "Joe"=>34);
Example 2
• $ages['Peter'] = "32"; $ages['Quagmire'] = "30";
$ages['Joe'] = "34";
Multidimensional Arrays
• In a multidimensional array, each element in the main array can

also be an array. And each element in the sub-array can be an
array, and so on.
• Example 1
• with automatically assigned ID keys:

$families = array
( "Griffin"=>array
( "Peter", "Lois", "Megan" ),

"Quagmire"=>array
( "Glenn" ),

"Brown"=>array
( "Cleveland", "Loretta", "Junior" )

);
Multidimensional Arrays



Example 2:
The array above would look like this if written to the output:





Array
(
[Griffin] => Array
 (
 [0] => Peter
 [1] => Lois
 [2] => Megan
 )
[Quagmire] => Array
 (
 [0] => Glenn
 )
[Brown] => Array
 (
 [0] => Cleveland
 [1] => Loretta
 [2] => Junior )
 )





•

displaying a single value from the array above:



echo "Is " . $families['Griffin'][2] . " a part of the Griffin family?";

Weitere ähnliche Inhalte

Was ist angesagt? (20)

Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
Lesson 4 constant
Lesson 4  constantLesson 4  constant
Lesson 4 constant
 
Class 3 - PHP Functions
Class 3 - PHP FunctionsClass 3 - PHP Functions
Class 3 - PHP Functions
 
Learn PHP Basics
Learn PHP Basics Learn PHP Basics
Learn PHP Basics
 
Class 2 - Introduction to PHP
Class 2 - Introduction to PHPClass 2 - Introduction to PHP
Class 2 - Introduction to PHP
 
Php variables (english)
Php variables (english)Php variables (english)
Php variables (english)
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
Lesson 2 php data types
Lesson 2   php data typesLesson 2   php data types
Lesson 2 php data types
 
php basics
php basicsphp basics
php basics
 
PHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with thisPHP Powerpoint -- Teach PHP with this
PHP Powerpoint -- Teach PHP with this
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
PHP Basic
PHP BasicPHP Basic
PHP Basic
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
PHP Basics
PHP BasicsPHP Basics
PHP Basics
 
PHP Workshop Notes
PHP Workshop NotesPHP Workshop Notes
PHP Workshop Notes
 
Php introduction
Php introductionPhp introduction
Php introduction
 
Php Chapter 2 3 Training
Php Chapter 2 3 TrainingPhp Chapter 2 3 Training
Php Chapter 2 3 Training
 

Andere mochten auch

Charting solutions evaluation-1
Charting solutions evaluation-1Charting solutions evaluation-1
Charting solutions evaluation-1krishnasasidharan
 
Cameron Frost: Prezi
Cameron Frost: PreziCameron Frost: Prezi
Cameron Frost: PreziCameron Frost
 
Internet by Javiera.
Internet by Javiera. Internet by Javiera.
Internet by Javiera. bargenperrin
 
Ci powerpoint
Ci powerpointCi powerpoint
Ci powerpointtanyacork
 
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...anshkhurana01
 
adarsh resume
adarsh resumeadarsh resume
adarsh resumeadarathi
 
Aix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbaiAix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbaianshkhurana01
 
E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...
E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...
E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...Expert and Consulting (EnC)
 
Cameron Frost Photography
Cameron Frost PhotographyCameron Frost Photography
Cameron Frost PhotographyCameron Frost
 
Introduction to BluWrap
Introduction to BluWrapIntroduction to BluWrap
Introduction to BluWrapBluWrap
 
Unit 5 proses 1 function and ability group 5
Unit 5 proses 1 function and ability group 5Unit 5 proses 1 function and ability group 5
Unit 5 proses 1 function and ability group 5Claudia Waloni
 
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaiSiebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaianshkhurana01
 

Andere mochten auch (17)

Charting solutions evaluation-1
Charting solutions evaluation-1Charting solutions evaluation-1
Charting solutions evaluation-1
 
Pathos presentation
Pathos presentationPathos presentation
Pathos presentation
 
Double cartridge seal
Double cartridge sealDouble cartridge seal
Double cartridge seal
 
Liquid properties
Liquid propertiesLiquid properties
Liquid properties
 
Cameron Frost: Prezi
Cameron Frost: PreziCameron Frost: Prezi
Cameron Frost: Prezi
 
Internet by Javiera.
Internet by Javiera. Internet by Javiera.
Internet by Javiera.
 
Ci powerpoint
Ci powerpointCi powerpoint
Ci powerpoint
 
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
Best spring classes in navi mumbai,spring course-provider in navi-mumbai,spri...
 
гис
гисгис
гис
 
adarsh resume
adarsh resumeadarsh resume
adarsh resume
 
Aix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbaiAix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbai
 
E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...
E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...
E&C Вrodaband 2015 Власть перезагрузка создание коммуникациинной платформы дл...
 
Cameron Frost Photography
Cameron Frost PhotographyCameron Frost Photography
Cameron Frost Photography
 
05php
05php05php
05php
 
Introduction to BluWrap
Introduction to BluWrapIntroduction to BluWrap
Introduction to BluWrap
 
Unit 5 proses 1 function and ability group 5
Unit 5 proses 1 function and ability group 5Unit 5 proses 1 function and ability group 5
Unit 5 proses 1 function and ability group 5
 
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaiSiebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
 

Ähnlich wie Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,best php-mysql classes in navi-mumbai

Ähnlich wie Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,best php-mysql classes in navi-mumbai (20)

Php Basics
Php BasicsPhp Basics
Php Basics
 
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
 
PHP MySQL Workshop - facehook
PHP MySQL Workshop - facehookPHP MySQL Workshop - facehook
PHP MySQL Workshop - facehook
 
Hsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfHsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdf
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
php Chapter 1.pptx
php Chapter 1.pptxphp Chapter 1.pptx
php Chapter 1.pptx
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php
PhpPhp
Php
 
Php unit i
Php unit iPhp unit i
Php unit i
 
Prersentation
PrersentationPrersentation
Prersentation
 
1. introduction to php and variable
1. introduction to php and variable1. introduction to php and variable
1. introduction to php and variable
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 

Mehr von anshkhurana01

sas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbai
sas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbaisas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbai
sas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbaianshkhurana01
 
Aix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbaiAix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbaianshkhurana01
 
Websphere application-server-training-course-navi-mumbai-websphere-applicatio...
Websphere application-server-training-course-navi-mumbai-websphere-applicatio...Websphere application-server-training-course-navi-mumbai-websphere-applicatio...
Websphere application-server-training-course-navi-mumbai-websphere-applicatio...anshkhurana01
 
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...anshkhurana01
 
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbaiLinux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbaianshkhurana01
 
Java j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbai
Java j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbaiJava j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbai
Java j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbaianshkhurana01
 
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaiSiebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaianshkhurana01
 
Tibco training-course-navi-mumbai-tibco-course-provider-navi-mumbai
Tibco training-course-navi-mumbai-tibco-course-provider-navi-mumbaiTibco training-course-navi-mumbai-tibco-course-provider-navi-mumbai
Tibco training-course-navi-mumbai-tibco-course-provider-navi-mumbaianshkhurana01
 
Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...
Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...
Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...anshkhurana01
 
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbaiMainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbaianshkhurana01
 
Sas training-course-navi-mumbai-sas-course-provider-navi-mumbai
Sas training-course-navi-mumbai-sas-course-provider-navi-mumbaiSas training-course-navi-mumbai-sas-course-provider-navi-mumbai
Sas training-course-navi-mumbai-sas-course-provider-navi-mumbaianshkhurana01
 
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbaiLinux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbaianshkhurana01
 
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbaiMysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbaianshkhurana01
 
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...Best java courses in navi mumbai best classes for java in navi mumbai-java cl...
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...anshkhurana01
 

Mehr von anshkhurana01 (15)

sas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbai
sas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbaisas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbai
sas-course-provider-navi-mumbai-sas-training-navi-mumbai-sas-classes-navi-mumbai
 
Sajid
SajidSajid
Sajid
 
Aix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbaiAix admin-course-provider-navi-mumbai
Aix admin-course-provider-navi-mumbai
 
Websphere application-server-training-course-navi-mumbai-websphere-applicatio...
Websphere application-server-training-course-navi-mumbai-websphere-applicatio...Websphere application-server-training-course-navi-mumbai-websphere-applicatio...
Websphere application-server-training-course-navi-mumbai-websphere-applicatio...
 
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
Shell scripting-training-course-navi-mumbai-shell-scripting-course-provider-n...
 
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbaiLinux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbai
 
Java j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbai
Java j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbaiJava j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbai
Java j2ee-training-course-navi-mumbai-java-j2ee-course-provider-navi-mumbai
 
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbaiSiebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
Siebel training-course-navi-mumbai-siebel-course-provider-navi-mumbai
 
Tibco training-course-navi-mumbai-tibco-course-provider-navi-mumbai
Tibco training-course-navi-mumbai-tibco-course-provider-navi-mumbaiTibco training-course-navi-mumbai-tibco-course-provider-navi-mumbai
Tibco training-course-navi-mumbai-tibco-course-provider-navi-mumbai
 
Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...
Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...
Embeddedsystem training-course-navi-mumbai-embeddedsysteml-course-provider-na...
 
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbaiMainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
Mainframe training-course-navi-mumbai-mainframe-course-provider-navi-mumbai
 
Sas training-course-navi-mumbai-sas-course-provider-navi-mumbai
Sas training-course-navi-mumbai-sas-course-provider-navi-mumbaiSas training-course-navi-mumbai-sas-course-provider-navi-mumbai
Sas training-course-navi-mumbai-sas-course-provider-navi-mumbai
 
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbaiLinux training-course-navi-mumbai-linux-course-provider-navi-mumbai
Linux training-course-navi-mumbai-linux-course-provider-navi-mumbai
 
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbaiMysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
Mysql classes in navi-mumbai,mysql course-provider-in-navi-mumbai
 
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...Best java courses in navi mumbai best classes for java in navi mumbai-java cl...
Best java courses in navi mumbai best classes for java in navi mumbai-java cl...
 

Kürzlich hochgeladen

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 

Kürzlich hochgeladen (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 

Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,best php-mysql classes in navi-mumbai

  • 1. Introduction to PHP •Server-Side Scripting •MYSQL •PHP •Apache •Variables •Control Structure •Looping
  • 2. A “script” is a collection of program or sequence of instructions that is interpreted or carried out by another program rather than by the computer processor. Client-side Server-side In server-side scripting, (such as PHP, ASP) the script is processed by the server Like: Apache, ColdFusion, ISAPI and Microsoft's IIS on Windows. Client-side scripting such as JavaScript runs on the web browser.
  • 3.  Advantages of Server-Side Scripting  Dynamic content.  Computational capability.  Database and file system access.  Network access (from the server only).  Built-in libraries and functions.  Known platform for execution (as opposed to client- side, where the platform is uncontrolled.)  Security improvements
  • 4. • PHP stands for PHP: Hypertext Preprocessor • Developed by Rasmus Lerdorf in 1994 • It is a powerful server-side scripting language for creating dynamic and interactive websites. • It is an open source software, which is widely used to develop dynamic websites. • It is an efficient alternative to competitors such as Microsoft's ASP.
  • 5. • PHP is perfectly suited for Web development and can be embedded directly into the HTML code. • The PHP syntax is very similar to JavaScript, Perl and C. • PHP is often used together with Apache (web server) on various operating systems. It also supports ISAPI and can be used with Microsoft's IIS on Windows. • PHP supports many databases (MySQL, Informix, Oracle, Sybase, Solid, Postgre SQL, Generic ODBC, etc.)
  • 6. • What is a PHP File? • PHP files have a file extension of ".php", ".php3", or ".phtml" • PHP files can contain text, HTML tags and scripts • PHP files are returned to the browser as plain HTML
  • 7. What you need to develop PHP Application: • Install Apache (or IIS) on your own server, install PHP, and MySQL • OR • Install Wampserver2 (a bundle of PHP, Apache, and MySql server) on your own server/machine
  • 8. • When a PHP document is requested of a server, the server will send the document first to a PHP processor • Two modes of operation – Copy mode in which plain HTML is copied to the output – Interpret mode in which PHP code is interpreted and the output from that code sent to output – The client never sees PHP code, only the output produced by the code
  • 9. • PHP statements are terminated with semicolons ; • Curly braces, { } are used to create compound statements • Variables cannot be defined in a compound statement unless it is the body of a function • PHP has typical scripting language characteristics – – – – Dynamic typing, un-typed variables Associative arrays Pattern matching Extensive libraries • Primitives, Operations, Expressions – Four scalar types: boolean, integer, double, string – Two compound types: array, object – Two special types: resource and NULL
  • 10. • A PHP scripting block always starts with <?php and ends with ?> <?php ……………. ?> – Other options are: 1. <? ……………… ?> 2. <script> ... </script> • There are three basic statements to output text with PHP: echo, print, and printf. Example: echo 'This is a <b>test</b>!'; • Comments: – # – // – /* . . . */
  • 11. Basic PHP Syntax  Inserting external files:  PHP provides four functions that enable you to insert code from external files: include() or require() include_once() or require_once() functions. • E.g.  include("table2.php"); – Included files start in copy mode
  • 12. Example 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Simple PHP Example</title> <body> <?php echo "Hello Class of 2011. This is my first PHP Script"; echo "<br />"; print "<b><i>What have you learnt and how many friends have you made?</i></b>"; echo "<br /><a href='PHP I-BSIC.ppt'>PHP BASIC</a>"; ?> </body> </html>
  • 13. PHP Variables • Variables are used for storing values, such as numbers, strings or function results, so that they can be used many times in a script. • All variables in PHP start with a $ sign symbol. • Variables are assigned using the assignment operator "=" • Variable names are case sensitive in PHP: $name is not the same as $NAME or $Name. • In PHP a variable does not need to be declared before being set. • PHP is a Loosely Typed Language.
  • 14. Strings in PHP • • • a string is a sequence of letters, symbols, characters and arithmetic values or combination of all tied together in single or double quotes. String literals are enclosed in single or double quotes Example: <?php $sum = 20; echo 'the sum is: $sum'; echo "<br />"; echo "the sum is: $sum"; echo "<br />"; echo '<input type="text" name="first_name" id="first_name">'; ?> – Double quoted strings have escape sequences (such as /n or /r) interpreted and variables interpolated (substituted) – Single quoted strings have neither escape sequence interpretation nor variable interpolation – A literal $ sign in a double quoted string must be escaped with a backslash, – Double-quoted strings can cover multiple lines
  • 15. PHP Function  In php a function is a predefined set of commands that are carried out when the function is called.  The real power of PHP comes from its functions.  PHP has more than 700 built-in or predefine functions for you to use.
  • 16. Using Built-in Function  Examples: Inserting external files:  PHP provides four functions that enable you to insert code from external files: include() or require() include_once() or require_once() functions.  A sample include file called add.php <html> <body> <?php function add( $x, $y ) { return $x + $y; } ?> <h1>Welcome to my home page</h1> <p>Some text</p> </body> </html> Using the include function <?php include('add.php'); echo add(2, 2); ?>
  • 17. PHP Functions - Adding parameters  A parameter is just like a variable.  The parameters are specified inside the parentheses. Syntax: <?php function function_name(param_1, ... , param_n) { statement_1; statement_2; ... statement_m; ?> } return return_value;
  • 18. PHP Functions - Adding parameters  Functions can also be used to return values. Example:   <html> <body>       <?php function add($x,$y) { $total = $x + $y; return $total; }   echo "1 + 16 = " . add(1,16); ?>   </body> </html>
  • 19. Control Structure  Control structures are the building blocks of any programming language. PHP provides all the control structures that you may have encountered anywhere. The syntax is the same as C or Perl.  Making computers think has always been the goal of the computer architect and the programmer. Using control structures computers can make simple decisions and when programmed cleverly they can do some complex things.
  • 20. PHP Switch Statement • If you want to select one of many blocks of code to be executed, use the Switch statement. • The switch statement is used to avoid long blocks of if..elseif..else code. Syntax switch (expression) { case label1: code to be executed if expression = label1; break; case label2: code to be executed if expression = label2; break; default: code to be executed if expression is different from both label1 and label2; }
  • 21. PHP Switch Statement               switch ($textcolor) { case "black": echo "I'm black"; break; case "blue": echo "I'm blue"; break; case "red": echo "I'm red"; break; default: // It must be something else echo "too bad!!, I'm something else"; }
  • 22. PHP Looping • Looping statements in PHP are used to execute the same block of code a specified number of times. • In PHP we have the following looping statements: – while - loops through a block of code if and as long as a specified condition is true – do...while - loops through a block of code once, and then repeats the loop as long as a special condition is true – for - loops through a block of code a specified number of times – foreach - loops through a block of code for each element in an array
  • 23. The while Statement Syntax while (condition) { // statements } Example <html> <head> <title>Let us count !!!</title></head> <body> <?php $limit = 10; echo "<h2> Let us count from 1 to $limit </h2><br />"; $count = 1; while ($count <= $limit) { echo "counting $count of $limit <br>"; $count++; } ?> </body> <html>
  • 24. The do...while Statement • The do...while statement will execute a block of code at least once - it then will repeat the loop as long as a condition is true. Syntax • do { code to be executed; } while (condition);         Example <html> <body> <?php $i=0; do { $i++; echo "The number is " . $i . "<br />"; } while ($i<5); ?> </body> </html>
  • 25. PHP Arrays  An array can store one or more values in a single variable name.  There are three different kind of arrays:  Numeric array - An array with a numeric ID key  Associative array - An array where each ID key is associated with a value  Multidimensional array - An array containing one or more arrays
  • 26. Numeric Array • A numeric array stores each element with a numeric ID key. • There are different ways to create a numeric array: Example 1 • In this example the ID key is automatically assigned: • $names = array("Peter","Quagmire","Joe"); Example 2 • In this example we assign the ID key manually: $names[0] = "Peter"; $names[1] = "Quagmire"; $names[2] = "Joe";
  • 27. Associative Arrays • Each ID key is associated with a value. • When storing data about specific named values, a numerical array is not always the best way to do it. • There are two ways of creating Associative Array: Example 1 • $ages = array("Peter"=>32, "Quagmire"=>30, "Joe"=>34); Example 2 • $ages['Peter'] = "32"; $ages['Quagmire'] = "30"; $ages['Joe'] = "34";
  • 28. Multidimensional Arrays • In a multidimensional array, each element in the main array can also be an array. And each element in the sub-array can be an array, and so on. • Example 1 • with automatically assigned ID keys: $families = array ( "Griffin"=>array ( "Peter", "Lois", "Megan" ), "Quagmire"=>array ( "Glenn" ), "Brown"=>array ( "Cleveland", "Loretta", "Junior" ) );
  • 29. Multidimensional Arrays   Example 2: The array above would look like this if written to the output:    Array ( [Griffin] => Array  (  [0] => Peter  [1] => Lois  [2] => Megan  ) [Quagmire] => Array  (  [0] => Glenn  ) [Brown] => Array  (  [0] => Cleveland  [1] => Loretta  [2] => Junior )  )   • displaying a single value from the array above:  echo "Is " . $families['Griffin'][2] . " a part of the Griffin family?";