SlideShare a Scribd company logo
PHP -  Introduction to  PHP Date and Time Functions
Introduction to PHPDateIntroduction to PHPDate
and Time Functionand Time Function
PHP Date() FunctionPHP Date() Function
•The PHP date() function formats a timestamp to
a more readable date and time.
PHP Date() FunctionPHP Date() Function
•The required format parameter in the date()
function specifies how to format the date/time.
 d - Represents the day of the month (01 to 31)
 m - Represents a month (01 to 12)
 Y - Represents a year (in four digits)
•Other characters, like"/", ".", or "-" can also be
inserted between the letters to add additional
formatting.
PHP Date() FunctionPHP Date() Function
PHP Date() FunctionPHP Date() Function
•The optional timestamp parameter in the date()
function specifies a timestamp. If you do not specify a
timestamp, the current date and time will be used.
•The mktime() function returns the Unix timestamp for a
date.
•The Unix timestamp contains the number of seconds
between the Unix Epoch (January 1 1970 00:00:00 GMT)
and the time specified.
PHP Date() FunctionPHP Date() Function
PHP Server Side IncludesPHP Server Side Includes
(SSI)(SSI)
•You can insert the content of one PHP file into
another PHP file before the server executes it, with
the include() or require() function.
•> include() generates a warning, but the script
will continue execution
•> require() generates a fatal error, and the script
will stop
PHP Server Side IncludesPHP Server Side Includes
(SSI)(SSI)
•These two functions are used to create functions, headers,
footers, or elements that will be reused on multiple pages.
•SSI saves a lot of work. This means that you can create a standard
header, footer, or menu file for all your web pages. When the
header needs to be updated, you update the include file, or
when you add a new page to your site, you can simply change
the menu file (instead of updating the links on all your web
pages).
PHP include() FunctionPHP include() Function
•The include() function takes all the content in a
specified file and includes it in the current file.
•If an error occurs, the include() function
generates a warning, but the script will continue
execution.
•Here's what the error output might look like...
PHP include() FunctionPHP include() Function
errorerror•Warning: include() [function.include]: URL file-access is
disabled in the server configuration in
/home/user/public_html/page.php on line xx
•Warning: include(http://www.somedomain.com/file.php)
[function.include]: failed to open stream: no suitable wrapper
could be found in /home/user/public_html/page.php on line
xx
•Warning: include() [function.include]: Failed opening
'http://www.somedomain.com/file.php' for inclusion
(include_path='.:/usr/lib/php:/usr/local/lib/php') in
/home/user/public_html/page.php on line xx
PHP include() FunctionPHP include() Function
•Assume that you have a standard header file, called
"header.php". To include the header file in a page, use
the include() function:
PHP include() FunctionPHP include() Function
•Assume we have a standard menu file, called
"menu.php", that should be used on all pages:
•And this is how you'd include it...
PHP: include() FunctionPHP: include() Function
Here's what the output HTML would look like...
PHP: include() FunctionPHP: include() Function
PHP require() FunctionPHP require() Function
•The require() function is identical to include(),
except that it handles errors differently.
•If an error occurs, the include() function
generates a warning, but the script will continue
execution. The require() generates a fatal error,
and the script will stop.
PHP require() FunctionPHP require() Function
So, if we use include()...
PHP require() FunctionPHP require() Function
The errors show, but the code still gets
executed. See how it echoed “Hello World”.
PHP require() FunctionPHP require() Function
But, if we use require() instead...
PHP require() FunctionPHP require() Function
We get only the error message – and the
code doesn't get executed.
PHP CookiesPHP Cookies
•A cookie is often used to identify a user.
•A cookie is a small file that the server
•embeds on the user's computer.
•Each time the same computer
requests a page with a browser,
it will send the cookie, too. With
PHP, you can both create
and retrieve cookie values.
PHP setcookie() FunctionPHP setcookie() Function
•The setcookie() function is used to set a cookie.
•Note: The setcookie() function must appear
BEFORE the <html> tag.
PHP setcookie() FunctionPHP setcookie() Function
•In the example below, we will create a cookie
named "user" and assign the value "Alex Porter" to it.
We also specify that the cookie should expire after
one hour:
PHP setcookie() FunctionPHP setcookie() Function
•You can also set the expiration time of the cookie
in another way. It may be easier than using
seconds.
PHP $_COOKIEPHP $_COOKIE
•The PHP $_COOKIE variable is used to retrieve a
cookie value.
•In the example below, we retrieve the value of the
cookie named "user" and display it on a page:
PHP $_COOKIEPHP $_COOKIE
If the cookie is set, receive a personal
welcome – if not, it echoes a generic greeting.
MySQL IntroductionMySQL Introduction
•MySQL is a database.
•The data in MySQL is stored in database objects
called tables.
•A table is a collection of related data entries
and it consists of columns and rows.
MySQL TablesMySQL Tables
•A database most often contains one or more
tables. Each table is identified by a name (e.g.
"Customers" or "Orders"). Tables contain records
(rows) with data.
•Below is an example of a table called "Persons":
MySQL QueriesMySQL Queries
•A query is a question or a request.
•With MySQL, we can query a database for specific
information and have a recordset returned.
•Look at the following query:
MySQL QueriesMySQL Queries
•The query above selects all the data in the
"LastName" column from the "Persons" table, and will
return a recordset like this:
MySQL mysql_connect()MySQL mysql_connect()
•Before you can access data in a database, you
must create a connection to the database.
•In PHP, this is done with the mysql_connect()
function.
MySQL mysql_connect()MySQL mysql_connect()
•In the following example we store the connection in a
variable ($con) for later use in the script. The "die" part
will be executed if the connection fails:
MySQL mysql_close()MySQL mysql_close()
•The connection will be closed automatically when
the script ends. To close the connection before, use
the mysql_close() function:
MySQL Create a DatabaseMySQL Create a Database
•The CREATE DATABASE statement is used to create a
database in MySQL.
•To get PHP to execute the statement above we
must use the mysql_query() function. This function is
used to send a query or command to a MySQL
connection.
MySQL Create a DatabaseMySQL Create a Database
MySQL Create a TableMySQL Create a Table
•The CREATE TABLE statement is used to create a
table in MySQL.
•We must add the CREATE TABLE statement to the
mysql_query() function to execute the command.
MySQL Create a TableMySQL Create a Table
This is the top part of the file.
The CREATE TABLE code is on the next slide...
MySQL Create a TableMySQL Create a Table
MySQL Create a TableMySQL Create a Table
•Important: A database must be selected before a
table can be created. The database is selected with
the mysql_select_db() function.
•Note: When you create a database field of type
varchar, you must specify the maximum length of the
field, e.g. varchar(15).
MySQL Create a TableMySQL Create a Table
•About Primary Keys and Auto Increment Fields:
•Each table should have a primary key field.
•A primary key is used to uniquely identify the rows in a
table. Each primary key value must be unique within
the table. Furthermore, the primary key field cannot
be null because the database engine requires a value
to locate the record.
MySQL Create a TableMySQL Create a Table
•The following example sets the personID field as the
primary key field. The primary key field is often an ID
number, and is often used with the
AUTO_INCREMENT setting. AUTO_INCREMENT
automatically increases the value of the field by 1
each time a new record is added. To ensure that the
primary key field cannot be null, we must add the
NOT NULL setting to the field.
MySQL Create a TableMySQL Create a Table
MySQL Inserting DataMySQL Inserting Data
•The INSERT INTO statement is used to add new
records to a database table.
•Syntax
•It is possible to write the INSERT INTO statement in two
forms.
MySQL Inserting DataMySQL Inserting Data
•The first form doesn't specify the column names
where the data will be inserted, only their values:
•The second form specifies both the column
names and the values to be inserted:
MySQL Inserting DataMySQL Inserting Data
•To get PHP to execute the statements above we must
use the mysql_query() function. This function is used to
send a query or command to a MySQL connection.
•Previously we created a table named "Persons", with
three columns; "Firstname", "Lastname" and "Age". We
will use the same table in this example. The following
example adds two new records to the "Persons" table:
MySQL Inserting DataMySQL Inserting Data
MySQL Inserting Data -MySQL Inserting Data -
formsforms
•Now we will create an HTML form that can
be used to add new records to the "Persons"
table.
MySQL Inserting Data -MySQL Inserting Data -
formsforms
•When a user clicks the submit button in the HTML form in
the example above, the form data is sent to "insert.php".
•The "insert.php" file connects to a database, and retrieves
the values from the form with the PHP $_POST variables.
•Then, the mysql_query() function executes the INSERT INTO
statement, and a new record will be added to the "Persons"
table.
MySQL Inserting Data -MySQL Inserting Data -
formsforms
MySQL Selecting DataMySQL Selecting Data
•The SELECT statement is used to select data from a
database.
•To get PHP to execute the statement above we must
use the mysql_query() function. This function is used to
send a query or command to a MySQL connection.
MySQL Selecting DataMySQL Selecting Data
MySQL Selecting DataMySQL Selecting Data
•The example above stores the data returned by
the mysql_query() function in the $result variable.
•Next, we use the mysql_fetch_array() function to
return the first row from the recordset as an array.
Each call to mysql_fetch_array() returns the next
row in the recordset. The while loop loops through
all the records in the recordset. To print the value
of each row, we use the PHP $row variable
($row['FirstName'] and $row['LastName']).
MySQL Selecting DataMySQL Selecting Data
•The output of the code from two slides back is:
•Here's how to return the data in an HTML table:
MySQL Selecting DataMySQL Selecting Data
MySQL Selecting DataMySQL Selecting Data
MySQL Selecting DataMySQL Selecting Data
•The WHERE clause is used to extract only those records
that fulfill a specified criterion.
•To get PHP to execute the statement above we must
use the mysql_query() function. This function is used to
send a query or command to a MySQL connection.
MySQL Selecting DataMySQL Selecting Data
MySQL OrderingMySQL Ordering
•The ORDER BY keyword is used to sort the data in a
recordset.
•The ORDER BY keyword sorts the records in
ascending order by default.
•If you want to sort the records in a descending order,
you can use the DESC keyword.
MySQL OrderingMySQL Ordering
MySQL OrderingMySQL Ordering
•It is also possible to order by more than one
column. When ordering by more than one
column, the second column is only used if the
values in the first column are equal:
MySQL UpdatingMySQL Updating
•The UPDATE statement is used to update existing
records in a table.
MySQL UpdatingMySQL Updating
•Note: Notice the WHERE clause in the UPDATE syntax.
The WHERE clause specifies which record or records that
should be updated. If you omit the WHERE clause, all
records will be updated!
•To get PHP to execute the statement above we must
use the mysql_query() function. This function is used to
send a query or command to a MySQL connection.
MySQL UpdatingMySQL Updating
MySQL DeletingMySQL Deleting
•The DELETE FROM statement is used to delete records
from a database table.
MySQL DeletingMySQL Deleting
•Note: Notice the WHERE clause in the DELETE syntax.
The WHERE clause specifies which record or records that
should be deleted. If you omit the WHERE clause, all
records will be deleted!
•To get PHP to execute the statement above we must
use the mysql_query() function. This function is used to
send a query or command to a MySQL connection.
MySQL DeletingMySQL Deleting
ThankThank You !!!You !!!
For More Information click below link:
Follow Us on:
http://vibranttechnologies.co.in/php-classes-in-mumbai.html

More Related Content

What's hot (20)

Modules in Python Programming
Modules in Python ProgrammingModules in Python Programming
Modules in Python Programming
sambitmandal
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
Zeeshan Ahmed
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
Vibrant Technologies & Computers
 
Exception handling
Exception handlingException handling
Exception handling
PhD Research Scholar
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
CPD INDIA
 
Php array
Php arrayPhp array
Php array
Nikul Shah
 
Java I/o streams
Java I/o streamsJava I/o streams
Java I/o streams
Hamid Ghorbani
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
lalithambiga kamaraj
 
Php forms
Php formsPhp forms
Php forms
Anne Lee
 
Exception Handling
Exception HandlingException Handling
Exception Handling
Reddhi Basu
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
Naz Abdalla
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
Kumar
 
Array of objects.pptx
Array of objects.pptxArray of objects.pptx
Array of objects.pptx
RAGAVIC2
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
 
Looping statements in Java
Looping statements in JavaLooping statements in Java
Looping statements in Java
Jin Castor
 
Operators php
Operators phpOperators php
Operators php
Chandni Pm
 
Java rmi
Java rmiJava rmi
Java rmi
kamal kotecha
 
Access Modifier.pptx
Access Modifier.pptxAccess Modifier.pptx
Access Modifier.pptx
Margaret Mary
 
Interface
InterfaceInterface
Interface
kamal kotecha
 

Viewers also liked (20)

Preparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability Extension
Preparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability ExtensionPreparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability Extension
Preparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability Extension
Safe Software
 
300 Years of Groundwater Management, Charles Porter
300 Years of Groundwater Management, Charles Porter300 Years of Groundwater Management, Charles Porter
300 Years of Groundwater Management, Charles Porter
TXGroundwaterSummit
 
Appendex b
Appendex bAppendex b
Appendex b
swavicky
 
Chapter 1Into the Internet
Chapter 1Into the InternetChapter 1Into the Internet
Chapter 1Into the Internet
Patty Ramsey
 
C# programs
C# programsC# programs
C# programs
Syed Mustafa
 
Application of dual output LiDAR scanning system for power transmission line ...
Application of dual output LiDAR scanning system for power transmission line ...Application of dual output LiDAR scanning system for power transmission line ...
Application of dual output LiDAR scanning system for power transmission line ...
Pedro Llorens
 
Appendex c
Appendex cAppendex c
Appendex c
swavicky
 
Chapter 5 Input
Chapter 5 InputChapter 5 Input
Chapter 5 Input
Patty Ramsey
 
5 Accessing Information Resources
5 Accessing Information Resources5 Accessing Information Resources
5 Accessing Information Resources
Patty Ramsey
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
Kengatharaiyer Sarveswaran
 
Intermediate PHP
Intermediate PHPIntermediate PHP
Intermediate PHP
Bradley Holt
 
Introduction to PHP - SDPHP
Introduction to PHP - SDPHPIntroduction to PHP - SDPHP
Introduction to PHP - SDPHP
Eric Johnson
 
LiDAR Aided Decision Making
LiDAR Aided Decision MakingLiDAR Aided Decision Making
LiDAR Aided Decision Making
Lidar Blog
 
Ch3(working with file)
Ch3(working with file)Ch3(working with file)
Ch3(working with file)
Chhom Karath
 
CIS 110 Chapter 1 Intro to Computers
CIS 110 Chapter 1 Intro to ComputersCIS 110 Chapter 1 Intro to Computers
CIS 110 Chapter 1 Intro to Computers
Patty Ramsey
 
Unix Master
Unix MasterUnix Master
Unix Master
Paolo Marcatili
 
Ch5(ms access with php)
Ch5(ms access with php)Ch5(ms access with php)
Ch5(ms access with php)
Chhom Karath
 
WE1.L10 - GRACE Applications to Regional Hydrology and Water Resources
WE1.L10 - GRACE Applications to Regional Hydrology and Water ResourcesWE1.L10 - GRACE Applications to Regional Hydrology and Water Resources
WE1.L10 - GRACE Applications to Regional Hydrology and Water Resources
grssieee
 
Appendex g
Appendex gAppendex g
Appendex g
swavicky
 
Chapter 9 Asynchronous Communication
Chapter 9 Asynchronous CommunicationChapter 9 Asynchronous Communication
Chapter 9 Asynchronous Communication
Patty Ramsey
 
Preparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability Extension
Preparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability ExtensionPreparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability Extension
Preparing LiDAR for Use in ArcGIS 10.1 with the Data Interoperability Extension
Safe Software
 
300 Years of Groundwater Management, Charles Porter
300 Years of Groundwater Management, Charles Porter300 Years of Groundwater Management, Charles Porter
300 Years of Groundwater Management, Charles Porter
TXGroundwaterSummit
 
Appendex b
Appendex bAppendex b
Appendex b
swavicky
 
Chapter 1Into the Internet
Chapter 1Into the InternetChapter 1Into the Internet
Chapter 1Into the Internet
Patty Ramsey
 
Application of dual output LiDAR scanning system for power transmission line ...
Application of dual output LiDAR scanning system for power transmission line ...Application of dual output LiDAR scanning system for power transmission line ...
Application of dual output LiDAR scanning system for power transmission line ...
Pedro Llorens
 
Appendex c
Appendex cAppendex c
Appendex c
swavicky
 
5 Accessing Information Resources
5 Accessing Information Resources5 Accessing Information Resources
5 Accessing Information Resources
Patty Ramsey
 
Introduction to PHP - SDPHP
Introduction to PHP - SDPHPIntroduction to PHP - SDPHP
Introduction to PHP - SDPHP
Eric Johnson
 
LiDAR Aided Decision Making
LiDAR Aided Decision MakingLiDAR Aided Decision Making
LiDAR Aided Decision Making
Lidar Blog
 
Ch3(working with file)
Ch3(working with file)Ch3(working with file)
Ch3(working with file)
Chhom Karath
 
CIS 110 Chapter 1 Intro to Computers
CIS 110 Chapter 1 Intro to ComputersCIS 110 Chapter 1 Intro to Computers
CIS 110 Chapter 1 Intro to Computers
Patty Ramsey
 
Ch5(ms access with php)
Ch5(ms access with php)Ch5(ms access with php)
Ch5(ms access with php)
Chhom Karath
 
WE1.L10 - GRACE Applications to Regional Hydrology and Water Resources
WE1.L10 - GRACE Applications to Regional Hydrology and Water ResourcesWE1.L10 - GRACE Applications to Regional Hydrology and Water Resources
WE1.L10 - GRACE Applications to Regional Hydrology and Water Resources
grssieee
 
Appendex g
Appendex gAppendex g
Appendex g
swavicky
 
Chapter 9 Asynchronous Communication
Chapter 9 Asynchronous CommunicationChapter 9 Asynchronous Communication
Chapter 9 Asynchronous Communication
Patty Ramsey
 
Ad

Similar to PHP - Introduction to PHP Date and Time Functions (20)

Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
ADARSH BHATT
 
Php summary
Php summaryPhp summary
Php summary
Michelle Darling
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
Rajamanickam Gomathijayam
 
PHP with MYSQL
PHP with MYSQLPHP with MYSQL
PHP with MYSQL
R.Karthikeyan - Vivekananda College
 
Php
PhpPhp
Php
khushbulakhani1
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
krutitrivedi
 
Php
PhpPhp
Php
samirlakhanistb
 
Php
PhpPhp
Php
supriya pandit
 
Php my sql programing - brochure
Php   my sql programing - brochurePhp   my sql programing - brochure
Php my sql programing - brochure
Zabeel Institute
 
Php and MySQL Web Development
Php and MySQL Web DevelopmentPhp and MySQL Web Development
Php and MySQL Web Development
w3ondemand
 
Php session
Php sessionPhp session
Php session
argusacademy
 
php databse handling
php databse handlingphp databse handling
php databse handling
kunj desai
 
Php classes in mumbai
Php classes in mumbaiPhp classes in mumbai
Php classes in mumbai
aadi Surve
 
PHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHPPHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHP
Vibrant Technologies & Computers
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
tutorialsruby
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
tutorialsruby
 
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
tutorialsruby
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
tutorialsruby
 
Web Server Programming - Chapter 1
Web Server Programming - Chapter 1Web Server Programming - Chapter 1
Web Server Programming - Chapter 1
Nicole Ryan
 
Php1
Php1Php1
Php1
mohamed yusuf
 
Ad

More from Vibrant Technologies & Computers (20)

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
Vibrant Technologies & Computers
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
Vibrant Technologies & Computers
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
Vibrant Technologies & Computers
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
Vibrant Technologies & Computers
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
Vibrant Technologies & Computers
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
Vibrant Technologies & Computers
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
Vibrant Technologies & Computers
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
Vibrant Technologies & Computers
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
Vibrant Technologies & Computers
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
Vibrant Technologies & Computers
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
Vibrant Technologies & Computers
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
Vibrant Technologies & Computers
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
Vibrant Technologies & Computers
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
Vibrant Technologies & Computers
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
Vibrant Technologies & Computers
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
Vibrant Technologies & Computers
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
Vibrant Technologies & Computers
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
Vibrant Technologies & Computers
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
Vibrant Technologies & Computers
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
Vibrant Technologies & Computers
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
Vibrant Technologies & Computers
 

Recently uploaded (20)

End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
IntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdfIntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdf
Luiz Carneiro
 
Co-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using ProvenanceCo-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using Provenance
Paul Groth
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Scott M. Graffius
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
DevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical PodcastDevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical Podcast
Chris Wahl
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Create Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent BuilderCreate Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent Builder
DianaGray10
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
Palo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity FoundationPalo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity Foundation
VICTOR MAESTRE RAMIREZ
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
AI Creative Generates You Passive Income Like Never Before
AI Creative Generates You Passive Income Like Never BeforeAI Creative Generates You Passive Income Like Never Before
AI Creative Generates You Passive Income Like Never Before
SivaRajan47
 
Jira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : IntroductionJira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : Introduction
Ravi Teja
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
Improving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevExImproving Developer Productivity With DORA, SPACE, and DevEx
Improving Developer Productivity With DORA, SPACE, and DevEx
Justin Reock
 
IntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdfIntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdf
Luiz Carneiro
 
Co-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using ProvenanceCo-Constructing Explanations for AI Systems using Provenance
Co-Constructing Explanations for AI Systems using Provenance
Paul Groth
 
Oracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI ProfessionalOracle Cloud Infrastructure Generative AI Professional
Oracle Cloud Infrastructure Generative AI Professional
VICTOR MAESTRE RAMIREZ
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Mark Zuckerberg teams up with frenemy Palmer Luckey to shape the future of XR...
Scott M. Graffius
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
DevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical PodcastDevOps in the Modern Era - Thoughtfully Critical Podcast
DevOps in the Modern Era - Thoughtfully Critical Podcast
Chris Wahl
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Create Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent BuilderCreate Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent Builder
DianaGray10
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
Palo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity FoundationPalo Alto Networks Cybersecurity Foundation
Palo Alto Networks Cybersecurity Foundation
VICTOR MAESTRE RAMIREZ
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
AI Creative Generates You Passive Income Like Never Before
AI Creative Generates You Passive Income Like Never BeforeAI Creative Generates You Passive Income Like Never Before
AI Creative Generates You Passive Income Like Never Before
SivaRajan47
 
Jira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : IntroductionJira Administration Training – Day 1 : Introduction
Jira Administration Training – Day 1 : Introduction
Ravi Teja
 
LSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection FunctionLSNIF: Locally-Subdivided Neural Intersection Function
LSNIF: Locally-Subdivided Neural Intersection Function
Takahiro Harada
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 

PHP - Introduction to PHP Date and Time Functions

  • 2. Introduction to PHPDateIntroduction to PHPDate and Time Functionand Time Function
  • 3. PHP Date() FunctionPHP Date() Function •The PHP date() function formats a timestamp to a more readable date and time.
  • 4. PHP Date() FunctionPHP Date() Function •The required format parameter in the date() function specifies how to format the date/time.  d - Represents the day of the month (01 to 31)  m - Represents a month (01 to 12)  Y - Represents a year (in four digits) •Other characters, like"/", ".", or "-" can also be inserted between the letters to add additional formatting.
  • 5. PHP Date() FunctionPHP Date() Function
  • 6. PHP Date() FunctionPHP Date() Function •The optional timestamp parameter in the date() function specifies a timestamp. If you do not specify a timestamp, the current date and time will be used. •The mktime() function returns the Unix timestamp for a date. •The Unix timestamp contains the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time specified.
  • 7. PHP Date() FunctionPHP Date() Function
  • 8. PHP Server Side IncludesPHP Server Side Includes (SSI)(SSI) •You can insert the content of one PHP file into another PHP file before the server executes it, with the include() or require() function. •> include() generates a warning, but the script will continue execution •> require() generates a fatal error, and the script will stop
  • 9. PHP Server Side IncludesPHP Server Side Includes (SSI)(SSI) •These two functions are used to create functions, headers, footers, or elements that will be reused on multiple pages. •SSI saves a lot of work. This means that you can create a standard header, footer, or menu file for all your web pages. When the header needs to be updated, you update the include file, or when you add a new page to your site, you can simply change the menu file (instead of updating the links on all your web pages).
  • 10. PHP include() FunctionPHP include() Function •The include() function takes all the content in a specified file and includes it in the current file. •If an error occurs, the include() function generates a warning, but the script will continue execution. •Here's what the error output might look like...
  • 11. PHP include() FunctionPHP include() Function errorerror•Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/user/public_html/page.php on line xx •Warning: include(http://www.somedomain.com/file.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/user/public_html/page.php on line xx •Warning: include() [function.include]: Failed opening 'http://www.somedomain.com/file.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/page.php on line xx
  • 12. PHP include() FunctionPHP include() Function •Assume that you have a standard header file, called "header.php". To include the header file in a page, use the include() function:
  • 13. PHP include() FunctionPHP include() Function •Assume we have a standard menu file, called "menu.php", that should be used on all pages: •And this is how you'd include it...
  • 14. PHP: include() FunctionPHP: include() Function Here's what the output HTML would look like...
  • 15. PHP: include() FunctionPHP: include() Function
  • 16. PHP require() FunctionPHP require() Function •The require() function is identical to include(), except that it handles errors differently. •If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will stop.
  • 17. PHP require() FunctionPHP require() Function So, if we use include()...
  • 18. PHP require() FunctionPHP require() Function The errors show, but the code still gets executed. See how it echoed “Hello World”.
  • 19. PHP require() FunctionPHP require() Function But, if we use require() instead...
  • 20. PHP require() FunctionPHP require() Function We get only the error message – and the code doesn't get executed.
  • 21. PHP CookiesPHP Cookies •A cookie is often used to identify a user. •A cookie is a small file that the server •embeds on the user's computer. •Each time the same computer requests a page with a browser, it will send the cookie, too. With PHP, you can both create and retrieve cookie values.
  • 22. PHP setcookie() FunctionPHP setcookie() Function •The setcookie() function is used to set a cookie. •Note: The setcookie() function must appear BEFORE the <html> tag.
  • 23. PHP setcookie() FunctionPHP setcookie() Function •In the example below, we will create a cookie named "user" and assign the value "Alex Porter" to it. We also specify that the cookie should expire after one hour:
  • 24. PHP setcookie() FunctionPHP setcookie() Function •You can also set the expiration time of the cookie in another way. It may be easier than using seconds.
  • 25. PHP $_COOKIEPHP $_COOKIE •The PHP $_COOKIE variable is used to retrieve a cookie value. •In the example below, we retrieve the value of the cookie named "user" and display it on a page:
  • 26. PHP $_COOKIEPHP $_COOKIE If the cookie is set, receive a personal welcome – if not, it echoes a generic greeting.
  • 27. MySQL IntroductionMySQL Introduction •MySQL is a database. •The data in MySQL is stored in database objects called tables. •A table is a collection of related data entries and it consists of columns and rows.
  • 28. MySQL TablesMySQL Tables •A database most often contains one or more tables. Each table is identified by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with data. •Below is an example of a table called "Persons":
  • 29. MySQL QueriesMySQL Queries •A query is a question or a request. •With MySQL, we can query a database for specific information and have a recordset returned. •Look at the following query:
  • 30. MySQL QueriesMySQL Queries •The query above selects all the data in the "LastName" column from the "Persons" table, and will return a recordset like this:
  • 31. MySQL mysql_connect()MySQL mysql_connect() •Before you can access data in a database, you must create a connection to the database. •In PHP, this is done with the mysql_connect() function.
  • 32. MySQL mysql_connect()MySQL mysql_connect() •In the following example we store the connection in a variable ($con) for later use in the script. The "die" part will be executed if the connection fails:
  • 33. MySQL mysql_close()MySQL mysql_close() •The connection will be closed automatically when the script ends. To close the connection before, use the mysql_close() function:
  • 34. MySQL Create a DatabaseMySQL Create a Database •The CREATE DATABASE statement is used to create a database in MySQL. •To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection.
  • 35. MySQL Create a DatabaseMySQL Create a Database
  • 36. MySQL Create a TableMySQL Create a Table •The CREATE TABLE statement is used to create a table in MySQL. •We must add the CREATE TABLE statement to the mysql_query() function to execute the command.
  • 37. MySQL Create a TableMySQL Create a Table This is the top part of the file. The CREATE TABLE code is on the next slide...
  • 38. MySQL Create a TableMySQL Create a Table
  • 39. MySQL Create a TableMySQL Create a Table •Important: A database must be selected before a table can be created. The database is selected with the mysql_select_db() function. •Note: When you create a database field of type varchar, you must specify the maximum length of the field, e.g. varchar(15).
  • 40. MySQL Create a TableMySQL Create a Table •About Primary Keys and Auto Increment Fields: •Each table should have a primary key field. •A primary key is used to uniquely identify the rows in a table. Each primary key value must be unique within the table. Furthermore, the primary key field cannot be null because the database engine requires a value to locate the record.
  • 41. MySQL Create a TableMySQL Create a Table •The following example sets the personID field as the primary key field. The primary key field is often an ID number, and is often used with the AUTO_INCREMENT setting. AUTO_INCREMENT automatically increases the value of the field by 1 each time a new record is added. To ensure that the primary key field cannot be null, we must add the NOT NULL setting to the field.
  • 42. MySQL Create a TableMySQL Create a Table
  • 43. MySQL Inserting DataMySQL Inserting Data •The INSERT INTO statement is used to add new records to a database table. •Syntax •It is possible to write the INSERT INTO statement in two forms.
  • 44. MySQL Inserting DataMySQL Inserting Data •The first form doesn't specify the column names where the data will be inserted, only their values: •The second form specifies both the column names and the values to be inserted:
  • 45. MySQL Inserting DataMySQL Inserting Data •To get PHP to execute the statements above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection. •Previously we created a table named "Persons", with three columns; "Firstname", "Lastname" and "Age". We will use the same table in this example. The following example adds two new records to the "Persons" table:
  • 46. MySQL Inserting DataMySQL Inserting Data
  • 47. MySQL Inserting Data -MySQL Inserting Data - formsforms •Now we will create an HTML form that can be used to add new records to the "Persons" table.
  • 48. MySQL Inserting Data -MySQL Inserting Data - formsforms •When a user clicks the submit button in the HTML form in the example above, the form data is sent to "insert.php". •The "insert.php" file connects to a database, and retrieves the values from the form with the PHP $_POST variables. •Then, the mysql_query() function executes the INSERT INTO statement, and a new record will be added to the "Persons" table.
  • 49. MySQL Inserting Data -MySQL Inserting Data - formsforms
  • 50. MySQL Selecting DataMySQL Selecting Data •The SELECT statement is used to select data from a database. •To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection.
  • 51. MySQL Selecting DataMySQL Selecting Data
  • 52. MySQL Selecting DataMySQL Selecting Data •The example above stores the data returned by the mysql_query() function in the $result variable. •Next, we use the mysql_fetch_array() function to return the first row from the recordset as an array. Each call to mysql_fetch_array() returns the next row in the recordset. The while loop loops through all the records in the recordset. To print the value of each row, we use the PHP $row variable ($row['FirstName'] and $row['LastName']).
  • 53. MySQL Selecting DataMySQL Selecting Data •The output of the code from two slides back is: •Here's how to return the data in an HTML table:
  • 54. MySQL Selecting DataMySQL Selecting Data
  • 55. MySQL Selecting DataMySQL Selecting Data
  • 56. MySQL Selecting DataMySQL Selecting Data •The WHERE clause is used to extract only those records that fulfill a specified criterion. •To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection.
  • 57. MySQL Selecting DataMySQL Selecting Data
  • 58. MySQL OrderingMySQL Ordering •The ORDER BY keyword is used to sort the data in a recordset. •The ORDER BY keyword sorts the records in ascending order by default. •If you want to sort the records in a descending order, you can use the DESC keyword.
  • 60. MySQL OrderingMySQL Ordering •It is also possible to order by more than one column. When ordering by more than one column, the second column is only used if the values in the first column are equal:
  • 61. MySQL UpdatingMySQL Updating •The UPDATE statement is used to update existing records in a table.
  • 62. MySQL UpdatingMySQL Updating •Note: Notice the WHERE clause in the UPDATE syntax. The WHERE clause specifies which record or records that should be updated. If you omit the WHERE clause, all records will be updated! •To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection.
  • 64. MySQL DeletingMySQL Deleting •The DELETE FROM statement is used to delete records from a database table.
  • 65. MySQL DeletingMySQL Deleting •Note: Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted! •To get PHP to execute the statement above we must use the mysql_query() function. This function is used to send a query or command to a MySQL connection.
  • 67. ThankThank You !!!You !!! For More Information click below link: Follow Us on: http://vibranttechnologies.co.in/php-classes-in-mumbai.html