PHP AND DATABASES IN MYSQL. Prof. Assoc. Lule Ahmedi Course: Internet Programming

Similar documents
Q&A for Zend Framework Database Access

database abstraction layer database abstraction layers in PHP Lukas Smith BackendMedia

All MySQL and PHP training students receive a copy of Apress' Beginning PHP and MySQL 5: From Novice to Professional and other related courseware.

Mercury Users Guide Version 1.3 February 14, 2006

Accessing Your Database with JMP 10 JMP Discovery Conference 2012 Brian Corcoran SAS Institute

Using DataDirect Connect for JDBC with Oracle Real Application Clusters (RAC)

"SQL Database Professional " module PRINTED MANUAL

ICADBS504A Integrate database with a website

What is a database? COSC 304 Introduction to Database Systems. Database Introduction. Example Problem. Databases in the Real-World

Using Oracle Real Application Clusters (RAC)

Zend Framework Database Access

FileMaker 13. ODBC and JDBC Guide

ICOM 6005 Database Management Systems Design. Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 2 August 23, 2001

2015, André Melancia (Andy.PT) 1

Connecting to a Database Using PHP. Prof. Jim Whitehead CMPS 183, Spring 2006 May 15, 2006

Benchmarks of SQL Query Performance for ODBC and Oracle Call Interface

Database Systems. Lecture 1: Introduction

How-To: MySQL as a linked server in MS SQL Server

ICAB4136B Use structured query language to create database structures and manipulate data

OBJECTSTUDIO. Database User's Guide P

Supported Platforms and Software Requirements Effective on 7 May HULFT-DataMagic for Windows Ver.2.2.0

FileMaker 12. ODBC and JDBC Guide

How to Improve Database Connectivity With the Data Tools Platform. John Graham (Sybase Data Tooling) Brian Payton (IBM Information Management)

Writing Scripts with PHP s PEAR DB Module

edoc Document Generation Suite

To use MySQL effectively, you need to learn the syntax of a new language and grow

Introduction. Introduction: Database management system. Introduction: DBS concepts & architecture. Introduction: DBS versus File system

Configuring an Alternative Database for SAS Web Infrastructure Platform Services

Introduction: Database management system

DBX. SQL database extension for Splunk. Siegfried Puchbauer

and what does it have to do with accounting software? connecting people and business

Overview of Databases On MacOS. Karl Kuehn Automation Engineer RethinkDB

Connect to MySQL or Microsoft SQL Server using R

Advanced Object Oriented Database access using PDO. Marcus Börger

Talking to Databases: SQL for Designers

Maksym Iaroshenko Co-Founder and Senior Software Engineer at Eltrino. Magento non-mysql implementations

> ACCESSING SQL SERVER FROM IBM COGNOS BI SERVER.

Evaluation Checklist Data Warehouse Automation

Distributed Database Access in the LHC Computing Grid with CORAL

Introductory Concepts

Chapter 2: Interactive Web Applications

FileMaker 14. ODBC and JDBC Guide

Short notes on webpage programming languages

SQL Pass-Through and the ODBC Interface

Web Development Frameworks

Database System Architecture & System Catalog Instructor: Mourad Benchikh Text Books: Elmasri & Navathe Chap. 17 Silberschatz & Korth Chap.

Web Design Technology

Migration to SQL Server With Ispirer SQLWays 6.0

Database Access via Programming Languages

SQL Injection. The ability to inject SQL commands into the database engine through an existing application

COURSE OUTLINE UCLA EXTENSI ON MGMNT X

Increasing Driver Performance

Equipment Room Database and Web-Based Inventory Management

Turning ClearPath MCP Data into Information with Business Information Server. White Paper

Web-Based Database Applications ITP 300x (3 Units)

DB2 Application Development and Migration Tools

SOLUTION BRIEF. JUST THE FAQs: Moving Big Data with Bulk Load.

Ruby on Rails is a web application framework written in Ruby, a dynamically typed programming language The amazing productivity claims of Rails is

David M. Kroenke and David J. Auer Database Processing 11 th Edition Fundamentals, Design, and Implementation. Chapter Objectives

SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

1. What is SQL Injection?

7 Web Databases. Access to Web Databases: Servlets, Applets. Java Server Pages PHP, PEAR. Languages: Java, PHP, Python,...

Online Multimedia Winter semester 2015/16

Integrated Performance Monitoring

Internet Engineering: Web Application Architecture. Ali Kamandi Sharif University of Technology Fall 2007

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

Release Bulletin Sybase ETL Small Business Edition 4.2

Database Extension 1.5 ez Publish Extension Manual

Consolidate by Migrating Your Databases to Oracle Database 11g. Fred Louis Enterprise Architect

HTSQL is a comprehensive navigational query language for relational databases.

Identify resource intensive sessions in heterogeneous database environments with TOAD

Introduction. AppDynamics for Databases Version Page 1

<Insert Picture Here> Move to Oracle Database with Oracle SQL Developer Migrations

Performance Tuning for the JDBC TM API

How To Write A Web Server In Javascript

Web-Based Database Distributed Systems

Chapter 13. Introduction to SQL Programming Techniques. Database Programming: Techniques and Issues. SQL Programming. Database applications

CS346: Database Programming.

Sagent DataFlow Supported Databases

Financial Data Access with SQL, Excel & VBA

INFORMATION BROCHURE Certificate Course in Web Design Using PHP/MySQL

ASP.NET Programming with C# and SQL Server

Why developers should use ODBC instead of native proprietary database interfaces

LAMP Server A Brief Overview

The Advantages of PostgreSQL

Driver for JDBC Implementation Guide

If your organization is not already

Client vs. Server Implementations of Mitigating XSS Security Threats on Web Applications

Data Migration between Document-Oriented and Relational Databases

Database Driven Websites Using PHP with Informix

SOLUTION BRIEF. Advanced ODBC and JDBC Access to Salesforce Data.

PHP Tutorial From beginner to master

Elements of Advanced Java Programming

USING JE THE BE NNIFE FITS Integrated Performance Monitoring Service Availability Fast Problem Troubleshooting Improved Customer Satisfaction

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. Introduction to Databases. Why databases? Why not use XML?

Facebook Twitter YouTube Google Plus Website

Transcription:

PHP AND DATABASES IN MYSQL Prof. Assoc. Lule Ahmedi Course: Internet Programming

Web Database Architecture

Server-Side vs. Client-Side Execution When linking databases and Web pages, most of time Server-side code Embedded code with server-side execution Why not client-side execution? Clients are usually too far away Servers should not trust the clients Servers are designated to serve applications that might well require a lot more horsepower Disadvantage: Server might be overloaded while clients sit idle

PHP Database APIs Several API styles in PHP of connecting to a DB a) According to programming paradigm: Procedural database APIs Deprecated mysql extension mysqli improved extension, its procedural version Object-oriented database APIs PDOs (PHP Data Objects) mysqli improved extension, its object-oriented version PEAR::DB (written in PHP, not in C) b) According to abstraction level to vendor databases: Vendor-specific database APIs mysql and mysqli extensions for MySQL, OCI8 for Oracle, etc. Abstraction layer APIs (generic database APIs, i.e., vendor-neutral) PDO PEAR::DB ODBC drivers approach

Some DBMS Systems to Connect To

Vendor-Specific vs Generic APIs Tradeoff required selecting between these two approaches Vendor-specific APIs (mysql, mysqli,..) Pros: Complete functionality of a certain vendor db (say MySQL, or Oracle, or Microsoft SQL, or DB2 IBM, or..) covered Cons: Extension to support other vendor db-s (say MySQL, or Oracle, or Microsoft SQL, or DB2 IBM, or..) incurs additional development costs + learning new syntax Generic APIs (PDO, PEAR::DB, ODBC) Pros: Extension to other vendor db-s almost at no cost Cons: Functionality of a certain vendor db incompletely covered due to generalization (common layer)

Running Example: Bookstore Catalog

Running Example: Bookstore Catalog

Checking and Filtering Input Data - is used to strip any whitespace - is checked although it comes from an HTML - sensible screen data - when submitting user input to a database - when returning data from a database

Setting Up a Connection Nonpersistent connection Closes when a script finishes execution, or through the function call Since limited # of connections can exist at the same time Persistent connections Lives longer than the script itself To save connection/disconnection time and server overhead In original deprecated version as

Choosing a Database to Use

Querying the Database

Retrieving the Query Results - serves to encode characters with special meanings in HTML, like &, <, >, ", etc.

Disconnecting From the Database

Inserting Data Into the Database

Inserting Data Into the Database (cont.)

Other Useful PHP MySQL Functions (cont.) Freeing up resources: Example: Creating databases: Working with transactions: See php.net for a complete list of mysqli functions

Other PHP Database APIs A set of certain extension libraries available in PHP to connect to a specific vendor database: OCI8 for Oracle mssql for Microsoft SQL PostgreSQL IBM DB2 Informix Sybase MongoDB SQLite They all share common principles of connecting and querying Differ slightly on functionality If there is no support, i.e. no specific library available in PHP for a given database, use the generic ODBC functions Open Database Connectivity - a standard for connections to databases Limited functionality due to being designated to work with everything

Generic Database API: PEAR DB Object-oriented Offers database abstraction classes such as Metabase or PEAR::DB PEAR::DB abstraction layer is the core component of PEAR Vendor-neutral common abstraction layer Same function names for each different type of database Difference is basically syntactic, e.g., To connect: where To retrieve result rows:

Generic Database API: PDO PDO stands for PHP Data Objects Object-oriented Vendor-neutral common abstraction layer Same function names for each different type of database Difference is basically syntactic, e.g., To connect: To retrieve result rows:

References [1] PHP and MySQL Web Development (4th Edition). Luke Welling, Laura Thompson. Addison-Wesley Professional, 2014 [2] Fundamentals of Web Development. Randy Connolly, Ricardo Hoar. Pearson, 2014 php.net