Tài liệu Learning PHP Data Objects ppt

188 360 0
Tài liệu Learning PHP Data Objects ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... such a database elsewhere Using PHP Data Objects: First Steps Connection Strings Connection strings, or data source names (abbreviated DSN) as they are called in the PDO documentation, are PHP strings that carry such information as the name of the database management system and of the database itself, as well as other connection parameters Their advantage over using traditional methods of creating database... the book, and we will do our best to address it [] Introduction PHP Data Objects, (PDO) is a PHP5 extension that defines a lightweight DBMS connection abstraction library (sometimes called data access abstraction library) The need for a tool like PDO was dictated by the great number of database systems supported by PHP Each of these database systems required a separate extension that defined its own... introduce you to one of the most important extensions to PHP that are available, starting with PHP version 5.0—the PHP Data Objects, commonly known as PDO PHP grew in to a very popular web programming language due to its simplicity and ease of use One of the key factors of this growing success is the built-in possibility to access many popular relational database management systems (RDBMS), such as MySQL,... and exception handling Who This Book is For This book is targeted at PHP programmers, who are considering migrating to PHP 5 and using the new database connection abstraction library, PHP Data Objects While PDO is fully object oriented, the familiarity with this programming paradigm is required Novice users who are not familiar with PHP 5's object-oriented features may consider reading Appendix A first... arguments can be skipped SQLite is not a database server, but it is an embedded SQL database library that operates on local files More information about SQLite can be found at www.sqlite.org and more information about using SQLite with PHP can be found at www .php. net/sqlite Information about using SQLite with PDO can be obtained from www .php. net/manual/ en/ref.pdo-sqlite .php Connection Strings As you have... dynamic, database-driven applications with the PHP5 language Also we looked at how PDO can be effectively used to eliminate the differences between different traditional database access APIs and to produce a clearer and more portable code In the subsequent chapters, we will be looking at each of the features discussed in this chapter in a greater detail so that you fully master the PHP Data Objects. .. book, you can refer to PHP manual at www .php. net/pdo for technical information regarding installation and upgrade issues PECL is PHP Extension Community Library, a repository of PHP extensions written in C These extensions offer functionality that would be impossible to implement in PHP, as well as some extensions that exist for performance reasons as the C code is much faster than PHP The home page of... for a two-table database structure If we were to consider books written by more than one author, we would need three tables, which would make the example very complicated [ 21 ] Using PHP Data Objects: First Steps Creating the MySQL Database After you have launched your MySQL command line client, you will see the mysql> prompt, where you will be able to issue commands to create the database and the... books(author, title, isbn, publisher, year, summary) values( -> 1, 'Creating your MySQL Database: Practical Design Tips and Techniques', '1904811302', 'Packt Publishing Ltd', '2006', -> 'A short guide for everyone on how to structure your data and set-up your MySQL database tables efficiently and easily.'); [ 23 ] Using PHP Data Objects: First Steps Query OK, 1 row affected (0.00 sec) mysql> insert into books(author,... Sample Database Suppose that you have a good library at home and you want your computer to help you manage it You decide to create a web-based database using PHP and, of course, PDO From now on, the examples will be for MySQL and SQLite databases The Data Model As our database is really simple, we will just have two entities in it: authors and books Hence, we will be creating two tables with the same names . y0 w0 h1" alt="" Learning PHP Data Objects A Beginner's Guide to PHP Data Objects, Database Connection Abstraction Library for PHP 5 Dennis Popel . 17 Chapter 2: Using PHP Data Objects: First Steps 19 Connection Strings 20 Creating the Sample Database 21 The Data Model 21 Creating the MySQL Database 22 Designing

Ngày đăng: 15/02/2014, 16:20

Từ khóa liên quan

Mục lục

  • Cover

  • Table of Contents

  • Preface

  • Chapter 1: Introduction

    • Using PDO

      • Connecting to the Database

      • Connection Strings

      • Issuing SQL Queries, Quoting Parameters, and Handling Result Sets

      • Error Handling

      • Prepared Statements

      • Appropriate Understanding of PDO

      • Summary

      • Chapter 2: Using PHP Data Objects: First Steps

        • Connection Strings

          • Creating the Sample Database

            • The Data Model

            • Creating the MySQL Database

            • Designing Our Code

            • PDO Statements and Result Sets

            • Retrieving Result Set Metadata

            • Summary

            • Chapter 3: Error Handling

              • Sources of Errors

                • Server Software Failure or Overload

                • Improper Configuration of the Application

                • Improper Validation of User Input

                • Inserting a Record with a Duplicate Primary Key or Unique Index Value

Tài liệu cùng người dùng

Tài liệu liên quan