php reports sumit

Post on 14-Apr-2017

201 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

HI-TECH INSTITUTE OF ENGINEERING AND TECHNOLOGY

PRESENTATION ON “WEB PROGAMMING USING PHP & MySQL”

DEPARTMENT OF IT

S U B M I T T E D BY:N A M E - S U M I T K U M A R B I S W A SC O U R S E - B -T E C HB R A N C H - I T S E M - 7 T H Y E A R - 4 T H R O L L N O . - 1 1 2 2 0 1 3 0 2 3

CONTENT

• History of PHP• Introduction• What is MySQL?• What Does PHP Code Look like? • Comments in PHP• Variables in PHP• How to Show Output in PHP• PHP Operators• PHP Forms and User Inputs• HTML• CSS• Java Script

• PHP Database: MySQL• Connecting PHP to MySQL• About the Project• How To Access An Website

Page• Reasons for Choosing PHP • PHP Drawbacks • CONCLUSION

History of PHP

• PHP began in 1995 when Rasmus Lerdorf developed a Perl/CGI script toolset he called the Personal Home Page or PHP

• PHP 2 released 1997 (PHP now stands for Hypertext Processor).

• PHP3 released in 1998 (50,000 users)• PHP4 released in 2000 (3.6 million domains).

PHP5.0.0 released July 13, 2004 (113 libraries>1,000 functions with extensive object-oriented programming)

• PHP5.0.5 released Sept. 6, 2005 for maintenance and bug fixes

INTRODUCTION

What is PHP? • PHP stands for PHP: Hypertext Preprocessor • PHP is a server-side scripting language like ASP• PHP scripts are executed on the server • PHP supports many databases (MySQL, Informix,

Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc.)

• PHP is an open source software • PHP is free to download and use

INTRODUCTION

What is PHP File? • PHP files can contain text, HTML tags and scripts.• PHP files are returned to the browser as plain HTML.• PHP files have a file extension of ".php", ".php3", or

".phtml“.Where to Start? • To get access to a web server with PHP support, you

can: • Install Apache, Wamp,Xamp on your own server,

install PHP, and MySQL

What is MySQL ?

• MySQL is a database server • MySQL is ideal for both small and large applications • MySQL supports standard SQL • MySQL compiles on a number of platforms • MySQL is free to download and use

WHAT DOES PHP CODE LOOK LIKE?

• Structurally similar to C/C++• Supports procedural and object-oriented paradigm

(to some degree)• All PHP statements end with a semi-colon• Each PHP script must be enclosed in the reserved

PHP tag

<?php …?>

Comments in PHP

In PHP, we use // to make a single-line comment or /* and */ to make a large comment block.

VARIABLES IN PHP

• Variables are used for storing a values, like text strings, numbers or arrays.

• When a variable is set it can be used over and over again in your script All variables in PHP start with a $ sign symbol.

HOW TO SHOW OUTPUT IN PHP ?

• The PHP command ‘echo’ is used to output the parameters passed to it

• Syntax :<?php$txt=“Hello World”;echo $txt;?>OUTPUT: Hello World

PHP OPERATORS

• Arithmetic

PHP OPERATORS

• Assignment

PHP OPERATORS

• Comparison

PHP OPERATORS

• Logical

PHP FORMS AND USER INPUT

• The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.

• The $_GET variable is used to collect values from a form with method="get".

• EXAMPLE: <form action="welcome.php" method=“get">

• The $_POST variable is used to collect values from a form with method="post".

• EXAMPLE: <form action="welcome.php" method="post">

HTML

• HTML stands for Hypertext Markup Language, which is the main programming structure for web pages and browser software.

• When browser software accesses an HTML file it understands how to parse the document according to the file's extension.(.html - .txt - .php - .xml - .pdf - .doc - etc... ).

• HTML provides us a means of laying out and structuring our web pages using paragraphs, images, lists, indents, boxes, tables, colors, padding, and many more data structuring methods common to most data processing systems.

Basic HTML TagsThe Main Elements of an HTML Document<html> : Defines the beginning and end of an HTML document. It contains the <head>, <title>, and <body>

<head> : Used to describe or modify the content in the document. The head element contains the <meta>, and <title> elements<title> : Displays a page title in the browser tab bars and bookmark lists. The title element should come directly after your <meta> tags in the document and also communicates to search engine indexing bots to some degree.

<body> : Directly after the <head> element closes(</head>) we define our <body> element. This element contains everything that we want to display to the browser software. The body element can have attributes set in it to affect the entire document if the author so chooses.

Cascaded Style Sheet(CSS)

CSS is used to separate presentation and style from document markup content. CSS stands for Cascading Style SheetsStyles define how to display HTML elementsStyles were added to HTML 4.0 to solve a problemExternal Style Sheets can save a lot of workExternal Style Sheets are stored in CSS files

JavaScriptJavaScript (not to be confused with Java) is a scripting language that is widely used by many developers that focus on website and web applications creation. What is JavaScript?JavaScript was designed to add interactivity to HTML pagesJavaScript is a scripting languageA scripting language is a lightweight programming languageJavaScript is usually embedded directly into HTML pagesJavaScript is an interpreted language (means that scripts execute without preliminary compilation)Everyone can use JavaScript without purchasing a license

PHP Database: MySQL

• MySQL is the most popular open-source database system.

• MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to number of databases.

• MySQL is currently the world’s most popular and widely used open source database technology and data storage system. MySQL offers great reliability and ease of use. It is free, and comes with free documentation as well as thousands of programmers that share their code that relates to communicating with a MySQL database. The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements.

Connecting PHP to MySQL

• Before we can access data in a database, we must open a connection to the MySQL server.

• In PHP, this is done with the mysql_connect() function.• Syntax :• mysql_connect(host,username,password,dbname); Parameter Description

host Optional. Either a host name or an IP address

username Optional. The MySQL user name

password Optional. The password to log in with

dbname Optional. The default database to be used when performing queries

Other MySQL Commands• Mysql_close() : used to close an opened connection to

database• Mysql_query() : sends the sql query through the

specified connection string to database returns the result

• Mysql__fetch_array() : fetches result in an array from the returned value from the query

• Mysql_error() : returns current mysql error description

Other MySQL Commands

• mysql_connect("localhost", "mysql_user", "mysql_password") or die("Could not connect: " . mysql_error());mysql_select_db("mydb");

$result = mysql_query("SELECT id, name FROM mytable");

while ($row = mysql_fetch_array($result)) { printf("ID: %s Name: %s", $row[0], $row[1]); }mysql_free_result($result);

mysql_close();

How it Work MySQL

ABOUT THE PROJECT• In this project , we have created the website of our

college “ HIET WEBSITE”.• We have created several pages in our website:• Home Page• About Us • Login Page• T & P Activities & News• Faculty Profile• Events Page

HOME PAGE• Home page is the main page of website.• Whenever any user tries to look into the

website , this page opens.

ABOUT US PAGE• In this page of website , al the details of our college

are provided such as when the college was established .

LOGIN PAGE• We have 2 types of logins for our website :• Teacher Login where teacher can login to put certain details of

students like their marks .• Student Login where student can login to look for information like

examination details.

FACULTY PROFILE PAGE• In this page , we have provided all the details

of faculties of all departments.

EVENTS PAGE• In this page , we have provided all the details

of all the events like Crossroads etc.

31

How To Access An Website Page

Click To Proceed With The Steps

FaaDoOEngineers.com

32

Double Click on theInternet Explorerbutton

FaaDoOEngineers.com

33

Browser Window Opens

FaaDoOEngineers.com

34

Type the url address & Press Enter Key

http://www.hiet.org.in

FaaDoOEngineers.com

HTML files

Web Server Internet

RequestRequest

User makes a requestwww.hiet.org.in

http://www.hiet.org.in

FaaDoOEngineers.com

HTML files

Web Server Internet

Web PageWeb Page

HIET page is returned from the Web Server

Reasons for Choosing PHP

1. Easy to get started2. Designed for the web3. Free to use4. Many successful websites run on PHP

PHP Drawbacks

• PHP is a scripting language so it is slow (compared to C or C++)

• PHP is a scripting language with dynamic typing so it may have more undiscovered errors at run-time than a staticly typed language such as Java, C++ or C#

• PHP is an ugly/messy/uncool procedural language

CONCLUSION

• It is easier to create websites in php as compared to other technologies.

• We have created the website in php as php is easy to learn and runs efficiently on the server side.

• Secondly , php is free to use and it is compatible with almost all the servers used today.

THANK YOU

top related