SlideShare a Scribd company logo
1 of 30
 PHP stands for Hypertext PreProcessor.
 PHP is a server side scripting language that is
embedded in HTML.
 PHP allows web developers to create dynamic
web pages.
 It is integrated with a number of popular
databases, including MySQL, PostgreSQL,
Oracle, Sybase, Informix and SQL Server.
 PHP was written in the C programming language
by Rasmus Lerdorf in 1994.
 PHP originally stood for “Personal Home Page”.
 Simplicity
 Efficiency
 Security
 Flexibility
 PHP code must be included inside one of the 3
special markup tags:
<?php PHP CODE HERE ?>
<? PHP CODE HERE ?>
<script language=“php”>
PHP CODE HERE
</script>
<html>
<head>
<title>Sample PHP</title>
</head>
<body>
<h1>
<?php echo "Hello PHP Developers"; ?>
</h1>
</body>
</html>
 Variables are used to store the data.
 Here are the most important things about
variables in PHP:
i. All variables are denoted with a leading dollar
sign($).
ii. Variables do not have intrinsic types.
iii. PHP does a good job of automatically converting
types from one to another when necessary.
 PHP variables can be one of four scope types:
i. Local variables
ii. Function parameters
iii. Global variables
iv. Static variables
 A constant is a name or an identifier for a simple
value.
 A constant value cannot change during the execution
of the script.
 To define a constant you have to use define()
function and to retrieve the value of a constant.
 You can also use the function constant() to read a
constant’s value.
 PHP has 8 datatypes:
i. Integers
ii. Doubles
iii. Booleans
iv. NULL
v. Strings
vi. Arrays
vii. Objects
viii. Resources
 n is replaced by the newline character
 r is replaced by the carriage-return character
 t is replaced by the tab character
 $ is replaced by the dollar sign itself ($)
 " is replaced by a single double-quote (")
  is replaced by a single backslash ()
 Arithmetic Operators(+,-,*,/,%,++,--)
 Comparison Operators(==,!=,>,<,>=,<=)
 Logical or Relational Operators(and,or,&&,||,!)
 Assignment Operators(=,+=,-=,*=,/=,%=)
 Conditional or Ternary Operators( ?: )
 if-else Statement
if (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
 elseif Statement
if (condition)
code to be executed if condition is true;
elseif (condition)
code to be executed if condition is true;
else
code to be executed if condition is false;
 Switch Statement
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
above labels;
}
 for Statement
for (initialization; condition; updation)
{
code to be executed;
}
 while Statement
while (condition)
{
code to be executed;
}
 do-while Statement
do
{
code to be executed;
}
while (condition);
 foreach Statement
foreach (array as value)
{
code to be executed;
}
 An array is a data structure that stores one or
more type of values in a single variable.
 Types of Arrays:
i. Numeric Array
ii. Associative Array
iii. Multidimensional Array
 These arrays can store numbers, strings and any
object.
 Here we have used array() function to create
array.
 Associative array will have their index as string
so that you can establish a strong association
between key and values.
Creating Array:
$array_name=array(“str1”=>value1,
“str2”=>value2, ……
“strn”=>valuen);
Accessing Array Elements:
$array_name[‘str1’];
 A multi-dimensional 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.
 A function is a piece of code which takes one or
more input in the form of parameter and does
some processing and returns a value.
 Creating Function
function function_name(parameters list)
{
/* Code Here */
}
 Calling Function
function_name(parameters list);
 Cookies are text files stored on the client computer
and they are kept of use tracking purpose.
 There are 3 steps involved in identifying returning
users:
i. Server script sends a set of cookies to the browser.
ii. Browser stores this information on local machine for
future use.
iii. Next time, when the browser sends any request to the
web server, it sends those cookies information to the
server and server uses that information to identify the
user.
 PHP provided setcookie() function to set a cookie.
setcookie(name,value,expire,path,domain,security);
 To access cookies, use either $_COOKIE[name] or
$HTTP_COOKIE_VARS[name] variables.
 You can use isset() function to check if a cookie is set or
not.
CONNECTING TO MYSQL DATABASE
Opening a Database Connection
connection mysql_connect(dbserver, user, password,
new_link, client_flag);
Closing Database Connection
bool mysql_close(resource $link_identifier);
Selecting a Database
$retval=bool mysql_select_db(dn_name,connection);
Creating a Database/Executing Query
bool mysql_query(sql,connection);
Retrieving Data from Database
mysql_fetch_array($retval, type_array);
mysql_fetch_assoc($retval);

More Related Content

What's hot

Basic iOS Training with SWIFT - Part 2
Basic iOS Training with SWIFT - Part 2Basic iOS Training with SWIFT - Part 2
Basic iOS Training with SWIFT - Part 2Manoj Ellappan
 
2 variables and data types
2   variables and data types2   variables and data types
2 variables and data typesTuan Ngo
 
function, storage class and array and strings
 function, storage class and array and strings function, storage class and array and strings
function, storage class and array and stringsRai University
 
Strings in c
Strings in cStrings in c
Strings in cvampugani
 
Compiler: Programming Language= Assignments and statements
Compiler: Programming Language= Assignments and statementsCompiler: Programming Language= Assignments and statements
Compiler: Programming Language= Assignments and statementsGeo Marian
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptEPAM Systems
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypesVarun C M
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
Data types in php
Data types in phpData types in php
Data types in phpilakkiya
 

What's hot (20)

Basic iOS Training with SWIFT - Part 2
Basic iOS Training with SWIFT - Part 2Basic iOS Training with SWIFT - Part 2
Basic iOS Training with SWIFT - Part 2
 
2 variables and data types
2   variables and data types2   variables and data types
2 variables and data types
 
function, storage class and array and strings
 function, storage class and array and strings function, storage class and array and strings
function, storage class and array and strings
 
Strings in c
Strings in cStrings in c
Strings in c
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
Strings in c++
Strings in c++Strings in c++
Strings in c++
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Swift Study #3
Swift Study #3Swift Study #3
Swift Study #3
 
DIWE - Advanced PHP Concepts
DIWE - Advanced PHP ConceptsDIWE - Advanced PHP Concepts
DIWE - Advanced PHP Concepts
 
Javascript
JavascriptJavascript
Javascript
 
Compiler: Programming Language= Assignments and statements
Compiler: Programming Language= Assignments and statementsCompiler: Programming Language= Assignments and statements
Compiler: Programming Language= Assignments and statements
 
Strings in C
Strings in CStrings in C
Strings in C
 
ASSIGNMENT STATEMENTS AND
ASSIGNMENT STATEMENTS ANDASSIGNMENT STATEMENTS AND
ASSIGNMENT STATEMENTS AND
 
Complete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScriptComplete Notes on Angular 2 and TypeScript
Complete Notes on Angular 2 and TypeScript
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
Javascript
JavascriptJavascript
Javascript
 
String c
String cString c
String c
 
String in c
String in cString in c
String in c
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
Data types in php
Data types in phpData types in php
Data types in php
 

Similar to PHP

php&mysql with Ethical Hacking
php&mysql with Ethical Hackingphp&mysql with Ethical Hacking
php&mysql with Ethical HackingBCET
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technologyfntsofttech
 
Lecture3 php by okello erick
Lecture3 php by okello erickLecture3 php by okello erick
Lecture3 php by okello erickokelloerick
 
FYBSC IT Web Programming Unit IV PHP and MySQL
FYBSC IT Web Programming Unit IV  PHP and MySQLFYBSC IT Web Programming Unit IV  PHP and MySQL
FYBSC IT Web Programming Unit IV PHP and MySQLArti Parab Academics
 
Lecture17 ie321 dr_atifshahzad_js
Lecture17 ie321 dr_atifshahzad_jsLecture17 ie321 dr_atifshahzad_js
Lecture17 ie321 dr_atifshahzad_jsAtif Shahzad
 
Introduction To Php For Wit2009
Introduction To Php For Wit2009Introduction To Php For Wit2009
Introduction To Php For Wit2009cwarren
 
Web app development_php_04
Web app development_php_04Web app development_php_04
Web app development_php_04Hassen Poreya
 
Learn PHP Basics
Learn PHP Basics Learn PHP Basics
Learn PHP Basics McSoftsis
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questionssekar c
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript BootcampAndreCharland
 
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)Muhamad Al Imran
 
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)Muhamad Al Imran
 

Similar to PHP (20)

Training on php by cyber security infotech (csi)
Training on  php by cyber security infotech (csi)Training on  php by cyber security infotech (csi)
Training on php by cyber security infotech (csi)
 
php&mysql with Ethical Hacking
php&mysql with Ethical Hackingphp&mysql with Ethical Hacking
php&mysql with Ethical Hacking
 
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP TechnologyFnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
Fnt Software Solutions Pvt Ltd Placement Papers - PHP Technology
 
Lecture3 php by okello erick
Lecture3 php by okello erickLecture3 php by okello erick
Lecture3 php by okello erick
 
FYBSC IT Web Programming Unit IV PHP and MySQL
FYBSC IT Web Programming Unit IV  PHP and MySQLFYBSC IT Web Programming Unit IV  PHP and MySQL
FYBSC IT Web Programming Unit IV PHP and MySQL
 
Lecture17 ie321 dr_atifshahzad_js
Lecture17 ie321 dr_atifshahzad_jsLecture17 ie321 dr_atifshahzad_js
Lecture17 ie321 dr_atifshahzad_js
 
Introduction To Php For Wit2009
Introduction To Php For Wit2009Introduction To Php For Wit2009
Introduction To Php For Wit2009
 
lab4_php
lab4_phplab4_php
lab4_php
 
lab4_php
lab4_phplab4_php
lab4_php
 
Web app development_php_04
Web app development_php_04Web app development_php_04
Web app development_php_04
 
Php
PhpPhp
Php
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
Learn PHP Basics
Learn PHP Basics Learn PHP Basics
Learn PHP Basics
 
Php
PhpPhp
Php
 
PHP Reviewer
PHP ReviewerPHP Reviewer
PHP Reviewer
 
Php interview questions
Php interview questionsPhp interview questions
Php interview questions
 
Ajax and JavaScript Bootcamp
Ajax and JavaScript BootcampAjax and JavaScript Bootcamp
Ajax and JavaScript Bootcamp
 
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 i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 

More from Govardhan Bhavani (16)

Angular Application Setup.pptx
Angular Application Setup.pptxAngular Application Setup.pptx
Angular Application Setup.pptx
 
Files.pptx
Files.pptxFiles.pptx
Files.pptx
 
Pandas.pptx
Pandas.pptxPandas.pptx
Pandas.pptx
 
NumPy.pptx
NumPy.pptxNumPy.pptx
NumPy.pptx
 
ExpressJS and REST API.pptx
ExpressJS and REST API.pptxExpressJS and REST API.pptx
ExpressJS and REST API.pptx
 
NodeJS.pptx
NodeJS.pptxNodeJS.pptx
NodeJS.pptx
 
Angular.pptx
Angular.pptxAngular.pptx
Angular.pptx
 
JavaScript.pptx
JavaScript.pptxJavaScript.pptx
JavaScript.pptx
 
Maven.pptx
Maven.pptxMaven.pptx
Maven.pptx
 
Configure & Version Control-Git.pptx
Configure & Version Control-Git.pptxConfigure & Version Control-Git.pptx
Configure & Version Control-Git.pptx
 
DevOps.pptx
DevOps.pptxDevOps.pptx
DevOps.pptx
 
Agile XP.pptx
Agile XP.pptxAgile XP.pptx
Agile XP.pptx
 
Ajax
AjaxAjax
Ajax
 
CSS
CSSCSS
CSS
 
Unit 1part-2 forms & frames
Unit 1part-2 forms & framesUnit 1part-2 forms & frames
Unit 1part-2 forms & frames
 
Unit 1 (part-1, basic tags)
Unit 1 (part-1, basic tags)Unit 1 (part-1, basic tags)
Unit 1 (part-1, basic tags)
 

Recently uploaded

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
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
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 

Recently uploaded (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 

PHP

  • 1.
  • 2.  PHP stands for Hypertext PreProcessor.  PHP is a server side scripting language that is embedded in HTML.  PHP allows web developers to create dynamic web pages.  It is integrated with a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix and SQL Server.
  • 3.  PHP was written in the C programming language by Rasmus Lerdorf in 1994.  PHP originally stood for “Personal Home Page”.
  • 4.  Simplicity  Efficiency  Security  Flexibility
  • 5.  PHP code must be included inside one of the 3 special markup tags: <?php PHP CODE HERE ?> <? PHP CODE HERE ?> <script language=“php”> PHP CODE HERE </script>
  • 6. <html> <head> <title>Sample PHP</title> </head> <body> <h1> <?php echo "Hello PHP Developers"; ?> </h1> </body> </html>
  • 7.  Variables are used to store the data.  Here are the most important things about variables in PHP: i. All variables are denoted with a leading dollar sign($). ii. Variables do not have intrinsic types. iii. PHP does a good job of automatically converting types from one to another when necessary.
  • 8.  PHP variables can be one of four scope types: i. Local variables ii. Function parameters iii. Global variables iv. Static variables
  • 9.  A constant is a name or an identifier for a simple value.  A constant value cannot change during the execution of the script.  To define a constant you have to use define() function and to retrieve the value of a constant.  You can also use the function constant() to read a constant’s value.
  • 10.  PHP has 8 datatypes: i. Integers ii. Doubles iii. Booleans iv. NULL v. Strings vi. Arrays vii. Objects viii. Resources
  • 11.  n is replaced by the newline character  r is replaced by the carriage-return character  t is replaced by the tab character  $ is replaced by the dollar sign itself ($)  " is replaced by a single double-quote (")  is replaced by a single backslash ()
  • 12.  Arithmetic Operators(+,-,*,/,%,++,--)  Comparison Operators(==,!=,>,<,>=,<=)  Logical or Relational Operators(and,or,&&,||,!)  Assignment Operators(=,+=,-=,*=,/=,%=)  Conditional or Ternary Operators( ?: )
  • 13.
  • 14.
  • 15.  if-else Statement if (condition) code to be executed if condition is true; else code to be executed if condition is false;
  • 16.  elseif Statement if (condition) code to be executed if condition is true; elseif (condition) code to be executed if condition is true; else code to be executed if condition is false;
  • 17.  Switch Statement 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 above labels; }
  • 18.  for Statement for (initialization; condition; updation) { code to be executed; }
  • 19.  while Statement while (condition) { code to be executed; }
  • 20.  do-while Statement do { code to be executed; } while (condition);
  • 21.  foreach Statement foreach (array as value) { code to be executed; }
  • 22.  An array is a data structure that stores one or more type of values in a single variable.  Types of Arrays: i. Numeric Array ii. Associative Array iii. Multidimensional Array
  • 23.  These arrays can store numbers, strings and any object.  Here we have used array() function to create array.
  • 24.  Associative array will have their index as string so that you can establish a strong association between key and values. Creating Array: $array_name=array(“str1”=>value1, “str2”=>value2, …… “strn”=>valuen); Accessing Array Elements: $array_name[‘str1’];
  • 25.  A multi-dimensional 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.
  • 26.  A function is a piece of code which takes one or more input in the form of parameter and does some processing and returns a value.  Creating Function function function_name(parameters list) { /* Code Here */ }  Calling Function function_name(parameters list);
  • 27.  Cookies are text files stored on the client computer and they are kept of use tracking purpose.  There are 3 steps involved in identifying returning users: i. Server script sends a set of cookies to the browser. ii. Browser stores this information on local machine for future use. iii. Next time, when the browser sends any request to the web server, it sends those cookies information to the server and server uses that information to identify the user.
  • 28.  PHP provided setcookie() function to set a cookie. setcookie(name,value,expire,path,domain,security);  To access cookies, use either $_COOKIE[name] or $HTTP_COOKIE_VARS[name] variables.  You can use isset() function to check if a cookie is set or not.
  • 29. CONNECTING TO MYSQL DATABASE Opening a Database Connection connection mysql_connect(dbserver, user, password, new_link, client_flag); Closing Database Connection bool mysql_close(resource $link_identifier);
  • 30. Selecting a Database $retval=bool mysql_select_db(dn_name,connection); Creating a Database/Executing Query bool mysql_query(sql,connection); Retrieving Data from Database mysql_fetch_array($retval, type_array); mysql_fetch_assoc($retval);