Download presentation
Presentation is loading. Please wait.
1
PHP / MySQL Introduction
Welcome!!
2
Scripting Client Side Scripting Server Side Scripting
Scripts are run by the browser E.g. JavaScript, VBScript Server Side Scripting Utilizes web server technology Scripts are run on the web server User requests is fulfilled by running script on server to generate dynamic web pages E.g. PHP, ASP, Perl, Ruby, Java Server Pages
3
PHP Intro High level scripting language
Designed by Rasmus Lerdorf 1995 Open source Support for object oriented programming Similar to shell scripting language combined with C language Mainly used for web scripting
4
PHP Intro (cont.) Supports cookies, forms, sessions, network sockets, Supports databases: MySQL, Oracle, MS SQL, dbase, Sybase, DB2 PHP instructions can be embedded within HTML – right into the web page so when loaded PHP executes the code Most recent version: 5.38
5
MySQL Intro Most popular open source database
Relational database – data stored in tables Uses client / server model Supports sql structured query language – the standard langauge used by most db Fast, reliable, easy to use Connectivity, speed, security – highly suitable for accessing db on the internet Open source – owned by Oracle
6
Advantages of MySQL & PHP
Work very well together PHP – simple, powerful scripting MySQL – solid, reliable db Perfect combination for building db driven dynamic websites
7
Advantages of PHP/MySQL
High Performance PHP provides developers capability to rapidly release and update software on the web MySQL – response time and throughput meet demanding application needs Built in Library PHP libraries built to address common web development tasks Library functions often made available to PHP community
8
Advantages of PHP/MySQL (cont.)
Extensibility Developers around the world contribute add-on modules to extend functionality Allows applications to stay current Can obtain source code if desired Relatively Low Cost No licensing fees Runs on any platform – wide range of choices PHP developers share info – up to date, reliable
9
Advantages of PHP/MySQL
Portable Runs on most platforms Linux, Windows, Mac, Solaris Can copy from one server and move to another Developer Community Huge following Can find support on web, post problems, etc Ease of learning Relatively easy to learn PHP: similar to other languages, especially Perl MySQL – Uses SQL, if you know other db can learn quickly
10
Static Web Site Displays HTML code, nothing else, no interactivity
Client connects to apache server & requests html page (user types in URL) When client connects, server returns requested page Server is the middleman Static Web Site HTML Page (web browser) Apache Server Client
11
How Dynamic Web Works Apache Web Browser Send Form Request Form
Submit Form Confirm Get Confirmation User types in URL Web browser requests form Apache sends back form User fills in form and submits it Apache gets confirm message and sends it back Browser displays confirm message
12
Dynamic Web – with Database Demonstrates one way process: only putting data in the database
Database Apache Web Browser Send Form Request Form Database Confirm Submit Form Get Confirm Filling in form and want to store contents of form in a database This adds an extra step –website receives contents of form, web site puts the data in the database Sends confirmation back to browser
13
Common Situation: User fills in form and gets data from the database
Database Apache Web Browser Send Form Request Form Find Data Request Data Submit Form Send Results Results In the form , the user fills in request details (such as a search form) The server receives the search string and requests the results from the database Database finds the data and returns results to the server Server takes results and sends to the browser
14
How steps work using components HTTP, Apache, PHP, MySQL
Database Apache Web Browser 2. 1. Send Form Request Form 5. 4. 3. Find Data Request Data Submit Form 6. Send Results 7. Results
15
Steps User types in web address to access site
Browser connects to apache server which has html and php file that form the website. Apache services the request and sends the client the web page containing the html form User fills in the form and submits to the server
16
Steps (cont.) Apache receives the form and loads the file to handle form submission File contains php code to connect to the database PHP code is passed to the PHP interpreter and is run by the interpreter PHP connects to the MySQL database (may or may not be on the same server) When connected to MySQL, a request is made for info using SQL (language for communicating with database)
17
Steps (cont.) MySQL database receives SQL request and finds information. Result sent back to the PHP script that made the request PHP script receives result and constructs an HTML page with the results. Sends the HTML page back to the web browser client Web Browser receives HTML result and displays it to the user
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.