Learning PHP Data Objects and over one million other books are available for Amazon Kindle . Learn more


or
Sign in to turn on 1-Click ordering.
or
Amazon Prime free trial required. Sign up when you check out. Learn more
More Buying Choices
Have one to sell? Sell yours here
Learning PHP Data Objects
 
 
Start reading Learning PHP Data Objects on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Learning PHP Data Objects [Paperback]

Dennis Popel
4.0 out of 5 stars  See all reviews (2 customer reviews)
RRP: £24.99
Price: £23.74 & this item Delivered FREE in the UK with Super Saver Delivery. See details and conditions
You Save: £1.25 (5%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In stock.
Dispatched from and sold by Amazon.co.uk. Gift-wrap available.
Want guaranteed delivery by Monday, May 28? Choose Express delivery at checkout. See Details

Formats

Amazon Price New from Used from
Kindle Edition £12.35  
Paperback £23.74  
Amazon.co.uk Trade-In Store
Did you know you can trade in your old books for an Amazon.co.uk Gift Card to spend on the things you want? Visit the Amazon.co.uk Trade-In Store for more details.

Product details

  • Paperback: 174 pages
  • Publisher: PACKT PUBLISHING (29 Aug 2007)
  • Language English
  • ISBN-10: 1847192661
  • ISBN-13: 978-1847192660
  • Product Dimensions: 23.2 x 19 x 1.8 cm
  • Average Customer Review: 4.0 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 983,781 in Books (See Top 100 in Books)
  • See Complete Table of Contents

Product Description

Product Description

PDO is lighter, faster, and more powerful than existing PHP data abstraction interfaces. PDO is a common interface to different databases that must be used with a database-specific PDO driver to access a particular database server: the PDO extension does not provide a database abstraction by itself; it doesn't rewrite SQL, emulate missing database features, or perform any database functions using by itself. It performs the same role as other classic database abstraction layers such as ODBC and JDBC: it's a query abstraction layer that abstracts the mechanism for accessing a database and manipulating the returned records; each database driver that implements the PDO interface can also expose database-specific features as regular extension functions. ¬ PDO ships with PHP 5.1, and is available as an extension for PHP 5.0; it requires the new object-oriented features of PHP 5, and cannot run with earlier versions of PHP.

This book will teach you how to use the PDO, including its advanced features. Readers need to be aware of the basics of data abstraction and should be familiar with PHP.

About the Author

Dennis Popel is an experienced PHP/PHP5 developer currently working for an Australian web development company, Motive Media (www.motivemedia.com.au). Serving Sun Microsystems Australia, Luna Park Sydney, Alsco Holdings and Pine Solutions, amongst others, Dennis leads company development of proprietary, web-based, software solutions. In his spare time, he runs the onPHP5.com blog and works on an online RSS aggregator NewzMix. Dennis Popel has been developing with PHP for more than 5 years and is experienced in such fields as object-oriented design and MVC. Previously he has worked at Rapid Intelligence, another Australian-based web company, publisher of such popular titles as NationMaster.com, FactBites.com and Qwika.com. In the past, Dennis was developing proprietary Java applications. This book is devoted to all the people that introduced and guided me in this wonderful world of information technology.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

Tag this product

 (What's this?)
Think of a tag as a keyword or label you consider is strongly related to this product.
Tags will help all customers organise and find favourite items.
Your tags: Add your first tag
 

What Other Items Do Customers Buy After Viewing This Item?


Customer Reviews

5 star
0
3 star
0
2 star
0
1 star
0
Most Helpful Customer Reviews
2 of 2 people found the following review helpful
Format:Paperback
Overview: Learning PHP Data Objects, by Dennis Popel, is an introduction to PDO, which walks through the building of a believable test example - a library manager for your home library. Each chapter introduces a new facet of PDO and shows how to rewrite the appropriate parts of the application to slot the new ideas in. Very clear and easy to read. Non-PDO subjects are appropriately kept to the appendices.

I really couldn't find very much about this book that I didn't like. Ignoring the appendices, the book is 154 pages purely devoted to teaching PDO through examples, including error handling, working with BLOBs, even the creation of the M in MVC (Models).

I mentioned MVC there. One of my gripes with most tutorials of MVC is that they introduce the concept simply, then provide pages and pages of code with the end product which is "hello world". Why I should go to all that trouble instead of simply writing to the screen usually escapes me. Dennis, however, concentrates solely on the Model and shows exactly why it's a great idea. I think some more separation of concerns would have been better (don't mix Author and Book SQL in the same object, for example), but the ideas were all good.

I think that if Dennis was going to show how the Model works, he should also have gone a little further and showed an example of an Active Record pattern as well. But I guess the point of showing MVC was more to show /an/ example of abstraction of the DB code, and that was sufficient.

The book covers a Library manager application all the way through from conception to implementation, demonstrating at all points that the code works with SQLite and MySQL (and by implication, all other DBMS's) with a change of only the connection string.

Possible problems are explained clearly and solutions are provided. For example, Dennis explains why, after you compile the query select * from books, PDO (and indeed the database itself) does not know how many rows it will return. A solution, in the form of a very smart getRowCount() function shows a query-agnostic method for counting results of an arbitrary line of SQL.

Other areas that are covered in the book include error-handling, prepared statements and transaction-handling.

PDO can handle Prepared Statements even if the underlying DBMS cannot handle it, so it is possible to write your code in a cross-platform way. Examples of why you should use this are provided. One of the examples shows an efficient way to handle insertion or updating of a table using the same parameters for both cases, with the row-handling function deciding whether to use update or insert based on whether an ID was provided.

I feel the Transactions section could have been expanded a bit further. It is not explained how PDO handles this for DBMS's that don't internally support transactions, and I wouldn't like to assume that they work all the time, only to find after deleting critical data that it's not supported.

Overall, I enjoyed reading this book. Dennis is a good writer and I think he explained his thoughts very clearly.

On an aside, my four-year-old son Jareth loves Packt Publishing's books. Sometimes when I go to read another chapter, I need to covertly steal the book I'm reading back from him. For a while, he made it a bed-time ritual to grab all the Packt books he could find around and bring them up with him to read in bed. I think he loved the screen-shots and the frequent code samples. He's high-functioning autistic and likes literary constructs, and programming books are perfect for him in that regard. Thanks Packt, you've made my son (and therefore me) happy.
Comment | 
Was this review helpful to you?
1 of 1 people found the following review helpful
Format:Paperback
This book works well for the intermediate PHP programmer who has researched application structure, and is beginning to focus on improving the database layer by standardising on PDO.

Commendably it keeps a tight focus, providing the minimum context in which to show PDO features: in this case a basic library program with simple PHP methods providing HTML. However in a later chapter it provides a useful example that shows the advantage of the model, updating previous code accordingly. It also saves time by assuming you have your environment set up correctly.

Design patterns vary, I believe the idea is that the reader should research MVC separation and other patterns, decide how to use them, then incorporate the PDO features from the book; it doesn't enforce a particular methodology you may not want to use. Conversely this is a disadvantage to less experienced PHP programmers, as they won't be served by the least-common-denominator code examples, which don't enforce separation of HTML and PHP.

I would recommend the book on the subjects of security and database correctness. Using prepared statements the book provides you with a robust way to avoid SQL injection. When something goes wrong, it explains how to handle the error correctly with exceptions, without exposing potentially harmful information. Even beginners should familiarise themselves with these new features. For mission-critical database operations, it elaborates on transactions, which weren't a feature of the PHP 4 extensions, and are either handled natively or emulated with PDO. Again it doesn't let focus drift into validation, which isn't provided by PDO, so only cursory hard-coded examples are given.

If you prefer the task-oriented approach to learning, you'll like this book. It provides code and screen-shots to guide you through each step. If you're an advanced PHP programmer, there are a few things you may find interesting, such as the lesser known PDO configuration options, and BLOB support, but really I find this book aimed more at the intermediate procedural programmer. Indicative of this is the succinct "Introduction to OOP in PHP 5" appendix. If you supplement this with other application design literature and integrate the PDO techniques in the book, you'll certainly be another step towards making your systems more flexible and maintainable.
Comment | 
Was this review helpful to you?
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com:  5 reviews
3 of 4 people found the following review helpful
Good but a touch disappointed 18 July 2008
By William E. Reveal - Published on Amazon.com
Format:Paperback
This is a good start for PDO. The examples and methodology used to present the concepts for using PDO were very useful. The book steps you from the basic use of PDO in chapter 2, through error handling and a good discussion of prepared statements, on to the more advanced topics of PDO settings and transactions.

I felt transactions needed better treatment, including the fact that MySQL only does transactions with certain table types such an InnoDB. His examples in this chapter do not show he is using a transaction friendly table type for MySQL (sqlite is always). Nor does he explain why you would want to even use PDO transactions when your table type is not transaction friendly - it is implied that there is no benefit.

He finishes the discussion in chapter 7 by modifying his examples to better fit the MVC paradigm. Personally, I feel he should have just started with it instead of trying to modify the code but that is my prejudice. If he had, he might have had more room for those things he left out <rolls eyes>.

If this book had not been published by Packt, I would have been very disappointed in the content vs price - $40 for 154 pages on the topic. Since Packt does contribute to open source projects based on the book's subject, I kind of forgive the cost.

However, the multiple times the author says "outside the scope of this book" kept reminding me that I paid $40 for such a short book. At least one time, I would have really liked to see more discussion regarding something he said was outside the scope, as if the book was already 900 pages long. I do give kudos to the author of at least having an appendix on OOP considering PDO is all about OOP - although I would have much more preferred to have also seen OOP techniques used throughout the code examples instead of a minor comment.

One other minor gripe I had, the use of short tags <?= ?> instead of <?php echo ?> throughout the code examples. It drove me crazy since I can't use them and really wish I could (XML compatibility issues). And it also kept reminding me that the use of <?= is to save space and good grief, not like this book needed to save space. Anyone trying to use this code to learn will have to modify it if their php settings have short_tags off.
3 of 4 people found the following review helpful
Good Foundation Book 26 Sep 2007
By Sammy Sumer - Published on Amazon.com
Format:Paperback
I like the book's erudite methodology. The methodology of this book is based on the two tenets of sound education:

Informing
Demonstrating

In this books after the information I found lots of exercises, step by step, with plenty of pictures and screen shots that lead me through and demonstrated a process of task. These exercises are fantastic guides.
The author has used a case study approach, which is perfect for me because I learn by doing and practising.

The author has identified the stable and core concepts of PDO and presented them in a way that gives us the strongest possible starting point, no matter what our endeavour.

Be warned that you are assumed to have a basic understanding of Object Oriented Programming to make the most of this book.
0 of 1 people found the following review helpful
Could have been a smaller book considering the material presented. 28 Jan 2010
By John Brunton - Published on Amazon.com
Format:Paperback
This book isn't too bad for learning about PDO but the main disappointment I have with it is zero coverage of accessing stored procedures using PDO. I liked Chapter 7 - an advanced example in how to set up a MVC application. This is more real world but real world, or rather corporate applications would not put SQL code within program code. It would be placed in a stored procedure. That way, you only grant execute permissions to the procedures instead of Select, Insert, Update, Delete to the tables. Since it is the only book I know of on the subject, it is worth the money.
Search Customer Reviews
Only search this product's reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 

Search Customer Discussions
Search all Amazon discussions
   


Listmania!

Create a Listmania! list

Look for similar items by category


Look for similar items by subject


Feedback


Amazon.co.uk Privacy Statement Amazon.co.uk Delivery Information Amazon.co.uk Returns & Exchanges