CS 377 Database Systems. Li Xiong Department of Mathematics and Computer Science Emory University

Similar documents
COSC344 Database Theory and Applications PHP & SQL. Lecture 14

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

PHP for PL/SQL Developers. Lewis Cunningham JP Morgan Chase

Web Engineering (Lecture 08) WAMP

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 (

Chapter 11 Outline. A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming. Slide 11-2

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

PHP: Hypertext Preprocessor. A tutorial Introduction

Chapter 7:- PHP. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

B. V. Patel Institute of BMC & IT 2014

Lecture 12. PHP. cp476 PHP

The PHP language. Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017

IELM 511 Information Systems Design Labs 5 and 6. DB creation and Population

COMP284 Scripting Languages Lecture 9: PHP (Part 1) Handouts

Database Systems Fundamentals

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?

Web Scripting using PHP

Princess Nourah bint Abdulrahman University. Computer Sciences Department

This lecture. PHP tags

CS6501 IP Unit IV Page 1

PHP by Pearson Education, Inc. All Rights Reserved.

PHP. Interactive Web Systems

Databases PHP I. (GF Royle, N Spadaccini ) PHP I 1 / 24

Announcements. PS 3 is out (see the usual place on the course web) Be sure to read my notes carefully Also read. Take a break around 10:15am

Introduction of PHP Created By: Umar Farooque Khan

More Examples Using Functions and Command-Line Arguments in C++ CS 16: Solving Problems with Computers I Lecture #6

PHP. MIT 6.470, IAP 2010 Yafim Landa

Database and MySQL Temasek Polytechnic

DC71 INTERNET APPLICATIONS JUNE 2013

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley

Course and Contact Information. Course Description. Course Objectives

Server side basics CS380

San José State University College of Science / Department of Computer Science Introduction to Database Management Systems, CS157A-3-4, Fall 2017

CS145 Introduction. About CS145 Relational Model, Schemas, SQL Semistructured Model, XML

SQL User Defined Code. Kathleen Durant CS 3200

Basic PHP Lecture 17

MySQL On Crux Part II The GUI Client

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Database Systems Management

Running SQL in Java and PHP

SQL Commands & Mongo DB New Syllabus

Objectives. Structure. Munster Programming Training

COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts

Course and Contact Information. Course Description. Course Objectives

CS 3360 Design and Implementation of Programming Languages. Exam 1

BS-CS Program Outcomes Check-List (Spring 2012) Senior Project

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

Transbase R PHP Module

Running SQL in Java and PHP

A practical introduction to database design

(Worth 50% of overall Project 1 grade)

What is PHP? [1] Figure 1 [1]

CSC 337. Relational Databases and SQL. Rick Mercer

Draft. Students Table. FName LName StudentID College Year. Justin Ennen Science Senior. Dan Bass Management Junior

Locate your Advanced Tools and Applications

CSCI 585- Database Systems Spring 2008 Homework Assignment 2 Due: Tuesday, April

San José State University Computer Science Department CS157A: Introduction to Database Management Systems Sections 5 and 6, Fall 2015

Using Relational Databases for Digital Research

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Course Web Site. 445 Staff and Mailing Lists. Textbook. Databases and DBMS s. Outline. CMPSCI445: Information Systems. Yanlei Diao and Haopeng Zhang

Outline. Databases and DBMS s. Recent Database Applications. Earlier Database Applications. CMPSCI445: Information Systems.

Web Traffic - pct of Page Views

URLs and web servers. Server side basics. URLs and web servers (cont.) URLs and web servers (cont.) Usually when you type a URL in your browser:

Databases CSCI 201 Principles of Software Development

La Mesa Language Reference Manual COMS 4115: Programming Languages and Translators Professor Stephen Edwards

Using PHP with MYSQL

PHP Reference. To access MySQL manually, run the following command on the machine, called Sources, where MySQL and PhP have been installed:

CMPSCI445: Information Systems

Cleveland State University Department of Electrical and Computer Engineering. CIS 408: Internet Computing

CS1 Lecture 3 Jan. 18, 2019

CS4604 Prakash Spring 2016! Project 3, HTML and PHP. By Sorour Amiri and Shamimul Hasan April 20 th, 2016

PHP INTERVIEW QUESTION-ANSWERS

CSc Introduction to Computing

CS1 Lecture 3 Jan. 22, 2018

MYSQL DATABASE ACCESS WITH PHP

Course Topics. The Three-Tier Architecture. Example 1: Airline reservations. IT360: Applied Database Systems. Introduction to PHP

Mobile Forms Integrator

Who s Afraid of SQL Injection?! Mike Kölbl Sonja Klausburg Siegfried Goeschl

Options. Real SQL Programming 1. Stored Procedures. Embedded SQL

Programming for the Web with PHP

Full file at

CSC Web Programming. Introduction to JavaScript

DR B.R.AMBEDKAR UNIVERSITY B.Sc.(Computer Science): III Year THEORY PAPER IV (Elective 4) PHP, MySQL and Apache

CMPS 401 Survey of Programming Languages

Data Modelling and Databases. Exercise Session 7: Integrity Constraints

Basic PHP. Lecture 19. Robb T. Koether. Hampden-Sydney College. Mon, Feb 26, 2108

Hands-On Perl Scripting and CGI Programming

Oracle Application Express Users Guide

MATLAB - Lecture # 4

Databases. Web applications in PHP to query a database. Practice n. 4

Lecture 7 PHP Basics. Web Engineering CC 552

Chapter 13 : Informatics Practices. Class XI ( As per CBSE Board) SQL Commands. New Syllabus Visit : python.mykvs.in for regular updates

CBRN Data Import/Export Tool (CDIET) Presented by: Darius Munshi

CS637 Midterm Review

MySQL. A practical introduction to database design

:59:32 PM PST

CS 222/122C Fall 2016, Midterm Exam

Sample Copy. Not For Distribution

Transcription:

CS 377 Database Systems Database Programming in PHP Li Xiong Department of Mathematics and Computer Science Emory University

Outline A Simple PHP Example Overview of Basic Features of PHP Overview of PHP Database Programming

Web Database Programming Using PHP PHP (PHP: Hypertext Preprocessor) is a open source server-side scripting language for producing dynamic web pages PHP allows access to a database and execution of calculations and logic A PHP-enabled web server interprets the PHP code and dynamically construct the web page

Typical PHP architecture

Building a web application

LAMP LAMP (Linux, Apache, MySQL, Perl/PHP/Python)

A Hello World Example in PHP <?php // prints hello world echo "Hello World!";?> <?php?> PHP start tag PHP end tag Comments: // or /* */

PHP programming environment Place your PHP source files in your cs377/web directory /home/userid/cs377/web/helloworld.php The file can be accessed at http://cs377.mathcs.emory.edu/~userid/helloworld.php

PHP Variables, Data Types, and Programming Constructs PHP variable names Start with $ symbol Can include characters, letters, and underscore character (_) Strings and text Single-quoted strings - Literal strings that contain no PHP program variables Double-quoted strings Values from variables need to be interpolated into string Period (.) symbol String concatenate operator

PHP Variables, Data Types, and Programming Constructs Numeric data types Integers and floating points Programming language constructs For-loops, while-loops, and conditional if-statements Boolean expressions Comparison operators == (equal),!= (not equal), > (greater than), >= (greater than or equal), < (less than), and <= (less than or equal)

PHP Database Programming with Oracle Oracle OCI8 library provides API for accessing Oracle database PHP OCI manual http://www.php.net/manual/en/intro.oci8.php Free book from Oracle The Underground PHP and Oracle Manual"

Typical Steps for Database Programming Establish database connection Execute SQL statements Close database connection

Connect to an Oracle database oci_connect ( string $username, string $password, string $connection_string) Returns a connection identifier needed for most other database operations. Connection String for Math/CS Oracle server '//cs377.mathcs.emory.edu:1521/cs377'

Execute SQL statements oci_parse ( resource $connection, string $sql_text ) Prepares sql_text using connection and returns the statement identifier, which can be used with oci_execute() and other functions. Statement identifiers can be freed with oci_free_statement() or by setting the variable to null

Execute SQL statements bool oci_execute ( resource $statement [, int $mode] ) Executes a statement previously returned from oci_parse(). Statements like INSERT will have data committed to the database by default. For SELECT statements, query results can be fetched with functions like oci_fetch_array(). Each parsed statement may be executed multiple times

Process query results bool oci_fetch ( resource $statement ) Fetches the next row from a query into internal buffers accessible either with oci_result() oci_result ( resource $statement, mixed $field ) Returns the data from field in the current row, fetched by oci_fetch(). array oci_fetch_array ( resource $statement [, int $mode ] ) Returns an array containing the next row from a query. Each array entry corresponds to a column of the row.

Close Database Connection bool oci_close ( resource $connection ) Unsets connection

employee.php Demo

Course Project Build a JDBC application or PHP web application for a database of your own choice! Team of 1 or 2 students Tasks Design the database Define the database schema and load the (test) data Design and implement the GUI interface Design and implement the functionalities (the queries it supports) Minimum requirement Define and populate a database GUI interface that allows search conditions and displays the data Previous project examples Music collection Baseball game board Fraternity brothers database

Project Deliverables Project proposal Motivation and objectives Proposed application Plan of action Project workshop presentation/demo in class, Tuesday, 12/6 Pizza or cookies and prize Project report and source code Motivation and objectives Description of your application Discussion Potential extensions

Midterm Thursday, 10/13/2011, in class Open book, open notes, no laptops Format similar to homeworks Covered material Database concept ER model Relational model Mapping from ER to Relational model Relational algebra SQL