Lecture 4: Introduction to PHP 3 PHP & MySQL

Slides:



Advertisements
Similar presentations
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Advertisements

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:
NGT Information Technology Technical Discussion Bob DeHoff Info Tech, Inc.
What is it? –Large Web sites that support commercial use cannot be written by hand What you’re going to learn –How a Web server and a database can be used.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Database Connectivity Rose-Hulman Institute of Technology Curt Clifton.
Multiple Tiers in Action
MySQL and PHP By Trevor Adams.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
PHP Scripting Language. Introduction “PHP” is an acronym for “PHP: Hypertext Preprocessor.” It is an interpreted, server-side scripting language. Originally.
Ruby on Rails Creating a Rails Application Carol E Wolf CS396X.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Confidential ODBC May 7, Features What is ODBC? Why Create an ODBC Driver for Rochade? How do we Expose Rochade as Relational Transformation.
Web Application Architecture: multi-tier (2-tier, 3-tier) & mvc
RUBY ON RAILS It’s so rad. What we’ll cover  What is Ruby?  What is RoR?  Why RoR?  Developing with RoR  Deployment  Demo  Questions.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
Module 3: Table Selection
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
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 Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Web Application Development. Define ER model in QSEE Generate SQL Create Database mySQL Write Script to use TableEditor class Process to create A simple.
Web Application Development. Tools to create a simple web- editable database QSEE MySQL (or PHPMyAdmin) PHP TableEditor.
MySQL + PHP.  Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
DATABASE PROGRAMMING Lecture on 16 – 05 – PREVIOUS LECTURE QUIZ: - Some students were very creative in transforming 2NF to 3NF. Excellent! - Some.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
A Web-based Datamart application for MS report writing Rashmi Sahoo Advisor: Prof. Meiliu Lu Department of Computer Science California State University.
MET280: Computing for Bioinformatics Introduction to databases What is a database? Not a spreadsheet. Data types and uses DBMS (DataBase Management System)
PHP MySQL. SQL: Tables CREATE TABLE tablename { fieldname type(length) extra info,... } Extra info: –NULL (allows nulls in this field) –Not NULL (null.
Introduction to Internet Databases MySQL Database System Database Systems.
Chapter 6 PHP Interacts with Mysql Database. Introduction In PHP, there is no consolidated interface. Instead, a set of library functions are provided.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Web application architecture1 Based on Jim Conallen: Web Applications with UML.
CS453: Databases and State in Web Applications (Part 2) Prof. Tom Horton.
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Visual Database Creation with MySQL Workbench 도시정보시스템 설계
CS 440 Database Management Systems Stored procedures & OR mapping 1.
CS320 Web and Internet Programming SQL and MySQL Chengyu Sun California State University, Los Angeles.
Introduction to MySQL  Working with MySQL and MySQL Workbench.
 Project Team: Suzana Vaserman David Fleish Moran Zafir Tzvika Stein  Academic adviser: Dr. Mayer Goldberg  Technical adviser: Mr. Guy Wiener.
Introduction to Database Programming with Python Gary Stewart
INTRODUCTION TO DATABASES (MICROSOFT ACCESS)
Introduction to PHP FdSc Module 109 Server side scripting and
Relational database and SQL MySQL LAMP SQL queries
Multitier Architecture, MySQL & PHP
PHP / MySQL Introduction
CS 174: Server-Side Web Programming February 12 Class Meeting
Chapter 8 Working with Databases and MySQL
Web Browser server client 3-Tier Architecture Apache web server PHP
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
IntroductionToPHP Static vs. Dynamic websites
Tutorial 6 PHP & MySQL Li Xu
CS3220 Web and Internet Programming SQL and MySQL
UFCEUS-20-2 Web Programming
Web Application Development Using PHP
Presentation transcript:

Lecture 4: Introduction to PHP 3 PHP & MySQL

Web based 3-tier architecture

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 e.g. 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) .

Web based 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

Using MySQL in the persistence 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 available for modification

Tools to create a simple web-editable database QSEE MySQL client (or PHPMyAdmin) PHP Script

Define ER model in QSEE Generate SQL Create Database MySQL Write Script to process DB

QSEE Multi-case diagramming tool Entity-Relationship Diagrams All UML diagrams ++ Entity-Relationship Diagrams Generates SQL for various targets (including MySQL 4.0) Implements relationships automatically 1- many : adds primary key on 1-side as columns in the many side to make foreign keys Many-many : adds an new link table with the primary keys from both sides as foreign keys (and a joint primary key) Dependent (weak) entities : foreign key becomes part of the primary key Sets up the appropriate integrity constraints Action on delete and update for foreign keys

GUI interface to MySQL server (shares) PHPMyAdmin GUI interface to MySQL server (shares) GUI runs on stocks (the PHP server) Full access to a database for Creating tables Added data Browsing the data Import and Export of tables… Execute SQL queries (DML) or definitions (DML) But ..

PHPMyAdmin Interface

Command line MySQL Generated SQL comments are rejected by PHPMyAdmin login to shares directly using putty change directory to your project directory Enter: mysql –p use database source proj.sql

Command line MySQL

PHP/MySQL a simple example (1): DB Library - Table Book id title author 1 MySQL in Nutshell Dyer 2 PHP and MySQL Ullman 3 Javascript Smith

PHP/MySQL a simple example (2): // set up server, username, password & database $host="localhost"; // would be "shares" in cems $un="root"; // would be unix user in cems $pw=""; // would be original cems passsword $db="Library"; // would be unix user name // connect to the mysql server mysql_connect($host,$un,$pw); // select the database @mysql_select_db($db) or die( "Unable to select database");

PHP/MySQL a simple example (3): // build the query $query="SELECT * FROM book"; // run the query $result=mysql_query($query); // count the rows returned $num=mysql_numrows($result); // close the connection mysql_close();

PHP/MySQL a simple example (4): // run a loop outputting one row at a time while ($i < $num) { $id=mysql_result($result,$i,"id"); $title=mysql_result($result,$i,"title"); $author=mysql_result($result,$i,"author"); echo "<p>id: $id<br/>Title: $title<br/>Author: $author</p>"; $i++; } ?>

PHP/MySQL a simple example (5):