Multitier Architecture, MySQL & PHP

Slides:



Advertisements
Similar presentations
Connecting to Databases. connecting to DB DB server typically a standalone application Server runs on localhost for smaller sites –i.e. Same machine as.
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Lecture plan Information retrieval (from week 11)
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
1 Database Driven Web Application Clients Application Servers including web servers Database Server Traditional client-server (2-tier architecture): client:
Technical Architectures
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Lecture 2 Web application architecture. Themes Architecture : The large scale structure of a system, especially a computer system Design choice: The need.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
Multiple Tiers in Action
Lecture 4: Introduction to PHP 3 PHP & MySQL
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
PHP Scripting Language. Introduction “PHP” is an acronym for “PHP: Hypertext Preprocessor.” It is an interpreted, server-side scripting language. Originally.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Distributed Systems: Client/Server Computing
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
PHP Data Object (PDO) Khaled Al-Sham’aa. What is PDO? PDO is a PHP extension to formalise PHP's database connections by creating a uniform interface.
Web Application Programming Carol Wolf Computer Science.
DATABASE PROGRAMMING Lecture on 16 – 05 – PREVIOUS LECTURE QUIZ: - Some students were very creative in transforming 2NF to 3NF. Excellent! - Some.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Csi315csi315 Client/Server Models. Client/Server Environment LAN or WAN Server Data Berson, Fig 1.4, p.8 clients network.
The Client/Server Database Environment Ployphan Sornsuwit KPRU Ref.
Mainframe (Host) - Communications - User Interface - Business Logic - DBMS - Operating System - Storage (DB Files) Terminal (Display/Keyboard) Terminal.
Database Concepts CPTE 212 3/19/2015 John Beckett.
Lecture 7 Maintaining State (cookies & sessions) & MySQL Interaction (revisited)
DB MidWare CSIS 4490 N-Tier Client/Server Dr. Hoganson Database Middleware Early client/server database systems –Two tier –Server does business logic (data.
PHP Workshop ‹#› PHP Data Object (PDO). PHP Workshop ‹#› What is PDO? PDO is a PHP extension to formalise PHP's database connections by creating a uniform.
Web Technologies Lecture 8 Server side web. Client Side vs. Server Side Web Client-side code executes on the end-user's computer, usually within a web.
WEB SERVER SOFTWARE FEATURE SETS
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Text TCS INTERNAL Oracle PL/SQL – Introduction. TCS INTERNAL PL SQL Introduction PLSQL means Procedural Language extension of SQL. PLSQL is a database.
1 LM 6 Database Applications Dr. Lei Li. Learning Objectives Explain three components of a client-server system Describe differences between a 2-tiered.
Submitted by: Moran Mishan. Instructed by: Osnat (Ossi) Mokryn, Dr.
E-commerce Architecture Ayşe Başar Bener. Client Server Architecture E-commerce is based on client/ server architecture –Client processes requesting service.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
Presented by: K.AMARNATH Ht.no:10841f0045 Guided by: T.Suneetha.
2nd year Computer Science & Engineer
DEPTT. OF COMP. SC & APPLICATIONS
Business System Development
Chapter 9: The Client/Server Database Environment
Web Technologies IT230 Dr Mohamed Habib.
Database System Concepts and Architecture
The Client/Server Database Environment
Relational database and SQL MySQL LAMP SQL queries
MVC and other n-tier Architectures
The Client/Server Database Environment
The Client/Server Database Environment
Introduction to J2EE Architecture
PHP / MySQL Introduction
#01 Client/Server Computing
Web Browser server client 3-Tier Architecture Apache web server PHP
Lecture 1: Multi-tier Architecture Overview
Database Software.
Computer Science Department
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
IntroductionToPHP Static vs. Dynamic websites
Tutorial 6 PHP & MySQL Li Xu
Database Management Systems
PHP Forms and Databases.
UFCEUS-20-2 Web Programming
Web Servers (IIS and Apache)
Web Application Development Using PHP
#01 Client/Server Computing
Presentation transcript:

Multitier Architecture, MySQL & PHP Web Programming Multitier Architecture, MySQL & PHP

Multitier architecture : In software engineering, multi-tier architecture (often referred to as n-tier architecture) is a client–server architecture in which presentation, application processing, and data management functions are logically separated. For example, an application that uses middleware to service data requests between a user and a database employs multi-tier architecture. The most widespread use of multi-tier architecture is the three-tier architecture. N-tier application architecture provides a model by which developers can create flexible and reusable applications. By segregating an application into tiers, developers acquire the option of modifying or adding a specific layer, instead of reworking the entire application. Three-tier architectures typically comprise a presentation tier, a business or data access [logic] tier, and a data tier.

3-tier architecture (application view)

Advantages of the 3-tier architecture approach : the ability to separate logical components of an application ensures that applications are easy to manage and understand. i.e. experts can be employed that specialise in one of the layers e.g. user interface design because communication can be controlled between each logical tier of an application, changes in one tier, for example, the database access tier, do not have to affect the client component i.e. a change from one DBMS to another would only require a change to the component in the data access layer with little or no effect on the business/logic (middle) or UI layer. specific tools and technologies suited to each layer can be deployed (and may evolve at a different pace) .

Typical web-oriented 3-tier architecture

Web-oriented 3-tier architecture: tools & technologies Presentation tier – Browser / custom client, Client Side Scripting (JavaScript, ActionScript, VBScript etc.), Applets. Logical Tier – Web Server (Apache, IIS, Websphere etc.); Scripting Languages (PHP, Perl etc.), Programming Languages (Java, C, C# etc), Application Frameworks (Ruby on Rails etc.) Data Tier – Database Management System (DBMS) (Oracle, MySQL, SQL Server, DB2 etc.), XMLDB

MySQL in the persistence / data tier : Open Source (relational) database server Runs on many platforms (Unix & Windows) Networked server – no fancy GUI like MS Access. You can find clients (such as phpMyAdmin) that provide a GUI. Great for small, medium to large-sized applications (ebay, amazon, facebook etc. all make use of it)

MySQL in the persistence /data tier : MySQL Strengths High performance benchmarks very well against commercial dbs Low-cost no cost under open source licence Easy to configure and learn easy to set up, SQL compliant Portable Linux, Unix and Windows versions Open Source source code is available for modification

phpMyAdmin A MySQL client written in PHP Via a browser you can : Manage Databases Manage MySQL users Create tables, add/edit/delete data, browse data Submit queries (SQL) Import and Export tables A great way to learn SQL! phpMyAdmin @ localhost : http://localhost/phpmyadmin

phpMyAdmin interface: home pop-up sql window databases manage users import data export db db status phpmyadmin help mysql

PHP (main) API’s for using MySQL There are three main API options when considering connecting to a MySQL database server: PHP's MySQL Extension - original extension which provides a procedural interface and is intended for use only with MySQL versions older than 4.1.3. Can be used with versions of MySQL 4.1.3 or newer, but not all of the latest MySQL server features will be available. PHP's mysqli Extension - MySQL improved extension takes advantage of new features found in MySQL versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later. PHP Data Objects (PDO) - PHP Data Objects, or PDO, is a database abstraction layer that provides a consistent API regardless of the type of database server. In theory, it allows for the switch of the database server, from say Firebird to MySQL, with only minor changes to the PHP code.

Advantages of the mysqli API Object-oriented interface Support for Prepared Statements Support for Multiple Statements Support for Transactions Enhanced debugging capabilities Embedded server support Note: If using MySQL versions 4.1.3 or later it is strongly recommended that the mysqli extension is used.

example MySQL db Entity Model Example records (3) qid quote author dob dod url category 1 There is no remedy but to love more. Henry David Thoreau 1817 1862 http://en.wikipedia.org/wiki/Henry_David_Thoreau love 6 Work is the curse of the drinking classes. Oscar Wilde 1854 1900 http://en.wikipedia.org/wiki/Oscar_wilde humour 11 Religion is what keeps the poor from murdering the rich. Napoleon Bonaparte 1769 1821 http://en.wikipedia.org/wiki/Napoleon politics

example php script using mysqli // Connect to the db $mysqli = new mysqli('hostname','username','password','database'); //Send the query to the database and pull the records in a // certain category using the SELECT statement // If the result returns true if ($result = $mysqli->query("SELECT quote, url FROM quote WHERE category='love'")) { // print out the number of records retrieved echo 'For the category "love", there are ' .$result->num_rows.' records.<br/>'; // The "fetch_object()” method allows access to the returned // rows within the resource object ($result in this case). while ($row = $result->fetch_object()) { echo 'Quote: '.$row->quote.' '; echo 'URL: <a href='.$row->url.'>'.$row->url. '</a><br/>'; } else { // it’s an error & the query failed echo $mysqli->error; } // end else $mysqli->close();

Thanks…