Archives For MySQL

Over the past two days I updated all eight posts in my “Learning the Yii Framework” series. The series was originally begun in June of 2009, starting with version 1.0.6 of Yii. A fair amount has changed since then, particularly the switch from using the command-line tool to using the Web-based Gii to generate code. So I reviewed all of the writing and code to make sure it was up-to-date with what users will see when developing with Yii today (current version: 1.1.4). The introduction of Gii was the largest change, although a while back Yii also switched from a “list” Controller method with a “list” View file to “index” and “index”; also “show” became “view”. And the Zii extension of widgets are now used extensively (um…pun).

Considering the popularity of this series, I’m not thinking of self-publishing a complete Yii guide (depending upon how I feel after self-publishing a JavaScript book).

Some time ago I came across this post at Nettuts+ on the Top 20+ MySQL Best Practices. The ideas are simple, effective, and clearly explained. Well worth checking out if you use MySQL on a regular basis.

The second example site developed in my “Effortless E-Commerce with PHP and MySQL” book is now online. You can view it at http://ecom2.dmcinsights.com. This is a fully functioning site, at least in terms of what you learn how to do in the book. It is hooked up to a payment gateway (Authorize.net), in test mode. Test credit card numbers are listed for you to use. The code for the site can be downloaded from the book’s corresponding Web site. I’m going to figure out a reasonable way to make the administrative side of the site usable, too.

My “Effortless E-Commerce with PHP and MySQL” book is going to the printer on Tuesday (I believe). Barring any last minute changes, below you will find the complete table of contents. Those that have being paying attention to this book throughout the writing process may notice that Part Four: Extras has up and gone. This is entirely in part because I ran out of pages (I’m only allotted so many) and in part because many of the topics I was going to discuss separately in Part Four got moved into the other chapters. Five of the eleven chapters end with 3-7 pages of additional ideas, note, PHP code, MySQL tables, and so forth. I may develop some of these ideas further in this blog (both examples are very modular and extend-able). Edit: Unfortunately, due to page constraints, all of the bonus material had to be pulled from the chapters. I’ll make it all, plus some extra extras, available online. My apologies (but it’s completely out of my hands).

I’m in the process of completing the book’s corresponding Web site, as well as putting the second e-commerce example online. I’ll post those URL’s in the next couple of days.

As always, thanks for your interest in my work!

  • Introduction

  • Part 1: Fundamentals

  • Chapter 1: Getting Started
    • Identifying Your Business Goals
    • Researching Legal Issues
    • Choosing Web Technologies
    • Selecting a Web Host
    • Using a Payment System
    • The Development Process
  • Chapter 2: Security Fundamentals
    • Security Theory
    • PCI Requirements
    • Server Security
    • Using Secure Transactions
    • Common Vulnerabilities

  • Part 2: Selling Virtual Products

  • Chapter 3: First Site: Structure and Design
    • Database Design
    • Server Organization
    • Connecting to the Database
    • The Config File
    • The HTML Template
  • Chapter 4: User Accounts
    • Defining Helper Functions
    • Registration
    • Logging In
    • Logging Out
    • Managing Passwords
    • Improving the Security
  • Chapter 5: Managing Site Content
    • Creating an Administrator
    • Adding Pages
    • Displaying Page Content
    • Adding PDFs
    • Displaying PDF Content
    • Recommended Alterations
  • Chapter 6: Using PayPal
    • About PayPal
    • Testing PayPal
    • Integrating PayPal
    • Testing the Site
    • Using IPN
    • Renewing Accounts
    • Going Live

  • Part 3: Selling Physical Products

  • Chapter 7: Second Site: Structure and Design
    • About the Site
    • Database Design
    • Server Setup
    • Helper Files
    • The HTML Template
    • Newer MySQL Features
  • Chapter 8: Creating a Catalog
    • Preparing the Database
    • Shopping by Category
    • Listing Products
    • Indicating Availability
    • Showing Sale Prices
    • Highlighting Sales
    • Potential Alterations
  • Chapter 9: Building a Shopping Cart
    • Defining the Procedures
    • Defining the Helper Functions
    • Making a Shopping Cart
    • Making a Wish List
    • Calculating Shipping
    • Potential Alterations
  • Chapter 10: Checking Out
    • About Authorize.net
    • Creating a Test Account
    • Preparing the Site
    • Taking the Shipping Information
    • Taking the Billing Information
    • Processing Credit Cards
    • Completing the Order
    • Emailing Receipts
    • Testing the Site
    • Going Live
    • For Your Consideration
  • Chapter 11: Site Administration
    • Setting Up the Server
    • Adding Products
    • Adding Inventory
    • Creating Sales
    • Viewing Orders
    • Shipping Orders
    • Alterations and Additions

I’m very pleased to say that I’m in the process of wrapping up my next book, “Effortless E-Commerce with PHP and MySQL”. I’ve  completed the writing of all eleven chapters. Now I’m in the process of reviewing the PDF layouts of the chapters, which I’ll finish over the weekend (the book goes to the printer on Tuesday). Overall I think the book turned out quite well, although you’d expect me to say that! Unfortunately I did have to cut a couple of “bonus” chapters out, as I ran out of pages (the publisher institutes a hard limit on a book’s length), but I should be able to explain most of the bonus materials in blog postings here. I’ll post the final table of contents separately, and I still need to put the code for the second example online (actually, I need to create the official Web site for the book, too), but I wanted to quickly mention some of the book’s highlights, in no particular order:

  1. The book uses a free-flowing format. Most of the books I write are in Peachpit Press’s Visual QuickPro Guide or Visual QuickStart Guide series, which is fairly structured (two-column layout, etc.). This book is under the New Riders label, so it’s not pre-scripted in any way. This means that complicated bits of code get developed in a series of steps, with explanations; simple bits of code and very basic scripts just get presented in their entirety.
  2. There are two complete e-commerce example sites developed in the book. The two have very few overlapping features, so you’ll see lots of ways to do things. For example, how you perform MySQL queries using PHP is presented three different ways: the standard, direct method; using prepared statements; and using stored procedures. How to address the HTML-PHP relationship is also presented in two different ways. You’ll see how to do a site that requires registration and one that does not. You’ll manage inventory for physical products, create virtual content, setup repeating payments, and authorize credit card holds to be debited later. It’s very much a buffet of ideas, allowing you to pick and choose those you like best or are most appropriate for your e-commerce sites.
  3. You’ll get both the bigger picture (of the process, finding a host, developing a site, etc.) and lots of specific code and recommendations. The book teaches not just how to do things, but why you would want to do them this way or another way. In other words, there’s a larger proportion of theory discussed.
  4. Security is hammered constantly. The second chapter is all about security, from a general approach to preventing common attacks. All of the other chapters also use secure techniques but, just as importantly, indicate simple things you might casually have done, that have terrible security implications.
  5. The examples use third-party libraries for extra features. You’ll see how to integrate a WYSIWYG editor into a form so that an administrator can add HTML content. You’ll also apply three different, but simple, uses of the jQuery framework. And the Zend_Mail component of the Zend Framework is used so that an HTML or plain text version of an order receipt can be sent to the customer upon completing his or her order.
  6. Secure uploading of PDF and image files.
  7. The second e-commerce example uses an MVC (Model-View-Controller) approach to development, without tapping into a framework or requiring object-oriented programming. There’s a huge security and performance benefit by placing almost all of the database logic within the database (i.e., the Model). And all of the HTML is written into separate files (the View). The remaining PHP code (the Controller) is sparse and clean.
  8. I developed two versions of a really nice user-defined function for creating form elements, with the ability to handle both existing values (i.e., to make the form “sticky”) and error reporting.
  9. PHP’s relatively new Filter extension is used to validate many values.
  10. There are tons of recommendations for how you can modify and extend the examples. I think about half the chapters conclude with 3-5 pages of ideas, including that specific HTML, PHP, and MySQL, required to accomplish those alterations.

So there you have a somewhat random ten highlights of the book. Having written nearly 20 books over the past 10 years, over half of them involving PHP and MySQL in some capacity, I worry about giving readers something new and interesting. If you’re paying $20-30 for a book, you should feel like you’re not just getting a different wrapper on something I’ve already written. I think I really succeeded on that note here. And I hope you’ll feel the same.

My thanks, as always, to everyone who has provided feedback on this book idea and have expressed their interest in it. The book is currently listed at Amazon.com for $23.09 (the MSRP is $34.99). I’ll continue to post updates about its status here.