Later this year I’m going to write an e-commerce with PHP and MySQL book for Peachpit Press. This is a topic that’s often been requested by my readers and one I’m happy to finally address. I have written e-commerce chapters in my PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide and PHP 5 Advanced: Visual QuickPro Guide
books, but not to this extent. Specifically, those examples were unable to demonstrate the payment gateway system, as that’s so particular to each individual situation. This new book, whose title is still being determined, will cover everything you need to know to create an e-commerce site using PHP and MySQL. I’m going to describe my intentions for the book here, then ask for any questions, comments, and suggestions that you, the potential reader, may have.
UPDATE: I’ve just posted the rough table of contents. My apologies for the delay on this and my sincerest thanks to those interested in the book!
First of all, to be absolutely clear, the book will not teach PHP and MySQL, or HTML and CSS. The book will have to assume knowledge of those, making this entire book much more of an application of the technologies kind of guide (like the example chapters in my PHP and MySQL books). However, most readers will likely still learn some aspects of PHP, MySQL, HTML, and CSS that they didn’t know before. Also, this book will not be in Peachpit’s QuickStart or QuickPro series, in which specific topics are introduced, discussed, then demonstrated in step-by-step format. This book will be in New Riders’ Voices That Matter series (New Riders is a sibling publisher to Peachpit). That format does away with the steps and redundancy of showing the code in both step-by-step and entire script formats. This series will allow me to go into more detail on the why’s of the code, as well as include more, and prettier, images.
My hope, depending upon space constraints, is to use two separate examples in order to best describe every step of the way. One example would be content that’s delivered immediately and online. This could be PDFs or just subscriptions/access to content. The other example would be content that’s physical and shipped at a later point. The differences between the two are significant because:
- You cannot actually charge a user until the item they purchase ships.
- When that’s the case, additional administrative pages are required to indicate that the order has shipped.
So the online content example would use an immediate payment system and delivery of the content. The physical product example would place a hold on the user’s card, to be charged when the order ships.
The online content would also have a simpler database design; the physical products would be require a more complex design.
I also plan on using two different payment gateways, so you can get a sense of how different gateways work. One would be the popular PayPal, the second is yet to be determined.
My intention is to use only procedural programming, which will be accessible to the largest body of readers. The only exception would be if I decide to use a framework, like the Zend Framework, for one of the examples. If I do go that route, basic OOP would have to be used, although it should still be understandable by most readers.
Of course, being e-commerce, security will be discussed often, at length, and in detail. This includes everything from hosting issues to HTTPs connections to storing data.
I would hope to implement search functionality. As for other features, like customers being able to review items, make purchases without registering, etc., will probably have to be briefly discussed instead of demonstrating. Again, what I’m trying to accomplish is coverage of the most important information from a couple of view points.
So, what do you think? What would you like to see or not see? Any question and comment is welcome and much appreciated, just be aware that I need to approve comments before they appear, for security and integrity reasons. Thanks!

I think it would be useful to cover PCI Compliance, as this is a very important issue when developing a serious E-Commerce application.
I love your books – keep ‘em coming. Thanks!
Hi Larry this sound great, i like the way you are cooding and although i have two your books php advanced and php and mysql 6 I decide to buy this new because i know that i will learn some new things in it.
I’m interested which part of zend you will use i would be really happy if that would be Lucence search( because i’m courious to learn it), HTTPs sound great.
That is all
Best regards
Luka
Awesome! Mark one SOLD.
Your teaching methods are indeed, superb; and I look forward to this next one.
Hi Larry
your books on PHP and MySQL were the first books I purchased for myself as a reference because I found them easy to understand and find the questions I wanted answered.
Having a few years experience dealing with e-commerce solutions (shopping carts, booking systems, catalogs, subscriptions, direct marketing etc.) I’ve come across a few issues over the years.
A suggestion of a couple of things I know I would like to see explained properly to people in a book:
- I’d hope that your second solution you use as a payment module involves a professional solution i.e not PayPal. Possibly a common scenario for web development companies where the payment process works inline with the site and the payment gateway is a solution that has been provided by the bank. More the theoretical process of passing the details (merchant id; payment amount; transaction id + additional details; return URL) from the shop through to the merchant securely.
In my opinion I don’t think it’s really necessary to talk about PayPal as they have heaps of documentation on how to set up an account and integrate it with a cart. There are other much better solutions out there, unfortunately they don’t have the same global awareness.
- Stock management for an online store that has a/multiple physical stores as well.
- Designing a database to allow for easy searching/customer use.
- Use of Ajax to improve customer experience
- Creating a customer profiles from common searches. Ie. Setting up a profile database that records frequency of searches on various categories.
- Tips on what to look out for when integrating code into an existing open source product (very vague I know)…
- Disabling standard browser functions that a user might do that can cause errors in shopping carts i.e double clicking a payment button, using the browser back button etc.
- Security issues to look out for (other than using https:\\) like server security issues.
I’m sure I could come up with a hundred more but I know that these are the main issues that I would have loved to know when I started.
P.S. I’d love a copy if you’re thinking of giving any away when it’s done.
Hello Myles. I thought I’d reply to yours specifically since it’s so detailed and multifaceted.
- Starting at the bottom, I won’t be giving away this book for another nine months or so (i.e., when it comes out), so just ask when I give away some copies through the newsletter. Remind me of your thoughtful comments here!
- As for PayPal, I think it’s definitely necessary to talk about, even though it’s easy. First, it’s so common, and, second, what’s easy for some may not be easy for others. I will try to balance it with a totally different kind of gateway.
- Probably won’t be room to talk about physical store integration (plus that won’t apply to as many people) but will discuss stock management.
- Database design will be covered thoroughly in all aspects, although database design is for reliability (i.e., normalization) purposes first and foremost. Other needs can be addressed through the programming interface.
- Am strongly considering Ajax.
- I like the idea of adding customer features. I’ll see what the space allows.
- I had thought about tying into an OS software, but I don’t know how practical that is in a book like this.
- Preventing double-submissions is critical, but I disagree on the back button. I think it’s dreadful when sites attempt to disable common features like a back button, or simply state not to use them. That’s a horrible, unprofessional thing for a site to do. A well-programmed site instead properly handles such things as the user clicking the back button or attempting to submit a transaction multiple times. But you’re right in that it’s something to be covered.
Thanks again and please share if you have any more thoughts!
Some features integrated with jQuery or another AJAX javascript library would be nice. I could see this coming in handy when adding items to your cart, or updating quantities from the cart page. There might also be some use for a “quick look” at a product through Netflix-style AJAX tooltips.
Hey Larry,
Wow, an e-commerce book! When can I pre-order it?
I’ve read PHP and MySQL 2nd Edition and PHP 5 Advanced. Love the books – best technical writing I’ve ever seen.
I was going to suggest that an OOP example (like the Zend Framework) would be awesome. I’m just starting to mess around with Zend Framework (referring back to your books a lot) and would really like to see more OOP examples.
If you’re planning on doing two full examples in the book, maybe one could be procedural and the other OOP?
Whatever you decide, I’ll be looking forward to this book!
I’m going to reply en masse, rather than to each individually. First, thanks to everyone for the nice words, for the interest in my books, and for the feedback. I really, truly appreciate it all. A couple of specific thoughts…
- PCI Compliance, yes, a very necessary topic. Thanks!
- For using the Zend Framework, I was specifically thinking that writing about the Lucerne search would be a primary reason (or benefit). I might try to write about it before the book, though. Considering the other responses, I will seriously consider doing one procedural example and one in OOP-Zend Framework.
- I am thinking about adding an Ajax component, if there’s space in time. Because pretty much every good site uses Ajax (or Flash) these days. I love the Netflix Ajax additions!
- Search Engine Optimization is another topic someone mentioned, which is a good idea.
- Security comes up often in feedback, and from everyone. It’s perhaps the most important consideration and will be discussed frequently, thoroughly, and from all angles.
Thanks again and please keep it coming!
Looks like it’ll be a good book.
I’m a little surprised a Zend Framework (ZF) solution has been specifically mentioned.Using a ZF specific example, where would you start and stop? You would have to assume previous knowledge otherwise the book will be enormous!
I use ZF (and library classes in smaller projects) a lot, however, other developers I know use alternative frameworks. Framework specific examples restricts access to part of the audience. Personally, I think a general OOP implementation would be enough for those of us who use a framework to know how to apply it. It would also provide an opportunity for readers who bought your Advanced PHP book to extend their skills.
All the areas I would like to see in an e-commerce book have already been mentioned, but I’m looking forward to seeing which topics makes the short-list.
Thanks, Rob, for the feedback. As for Zend, one nice feature about it is you can use only the parts you need, which is good in general but particularly helpful here, should I go that route. But, yes, framework-specific examples may be limiting in terms of audience, and it’s that kind of thing that I need to balance as a writer. But I really couldn’t do a general OOP implementation, as that would require sound OOP knowledge, which would be more limiting. One nice thing about OOP is that you could use an OOP framework like Zend or PEAR without really knowing OOP, as opposed to writing something from scratch. Thanks again!
Hey Larry,
Lets just get the praise out of the way. Your books really are amazing. I could learn anything from you. I’ve bought a ton of stuff from Site*cough* and most of it sends me into a comma. haha.
Google checkout is pretty important but like pay pal there is a lot of info so you can eventually work it out (but it is a good system). Meanwhile, I would love it/prefer it, if you could create a bank/credit card system – even if it were a fantasy one.
Ideally, but impractically, it would be good if there were two fantasy banks to actually handle the data (one for customer end testing and one for business account testing )so that folk could test out their systems without harm – I would pay extra for that service %100 for sure (like the price of a second book or something) and annalyse their data by accessing the fantasy accounts. (If you did that, be sure and copy protect the idea.)
I like the idea of AJAX but also am v.fond of php & sql. As a learning point for handling e-commerce transactions (a major bug bear for many folk) I think its best to keep it simple as simple as poss because of all the handling issues to deal with.
Anyway, thanx …
Thanks for the nice words and for the feedback. Much, much appreciated! I had thought about Google checkout, but it’s equivalent to PayPal in terms of ease of use and (not quite) popularity. Doing something quite different, like a bank/CC is key.
I can’t wait for this book… Learning how an e-commerce site works will not only be useful for building e-commerce sites, but also for building other large scale applications with a member base. (Assuming you will be using a member base in this book)
I just emailed you to tell you how awesome you are at teaching… haha. I hope you don’t think it’s spam… it’s not!
Thanks for the nice words. Yes, there will be a member base aspect to the book.
Hello Larry,
I’ve learned a lot from your books. How would a developer implement a unique link solution similar to the Craigslist functionality. I would love a chapter on this particular functionality in one of your future books.
Keep up the good work,
Solie
Hello Solie and thanks for the nice words. I’ve made a note of your question and will see if I can’t answer it somehow. Larry
Larry, I am sorry for the double comment, but it seems I got a faster response this way. I want to tell people about the book I just finished and would like to know what link I should use for people to purchase online. I will write a review on Amazon for you.. I just can’t get over how much I learned from the book.
Thanks again….
No need to apologize and thanks for the recommendation. I would be able to provide you with a specific link but which exact book did you read? And Amazon reviews are always welcome and appreciated. Thanks!
Not necessarily the members area or maybe a members area where one would not have to supply a user name and password. Perhaps where just a unique link can be emailed and that link be the only credential needed to access their order, post, or the like. The only name I can call what I’m thinking is a Unique update link. I don’t mean to fill up your page but I’ve been dying to learn this functionality and have not found it anywhere yet. Please feel free to email me if you could point me in the right direction or perhaps I’ll have to wait for you book
Why don’t you write up a thorough description (with links to examples) of what you’re talking about and send it to me in an email. I’ll see if I can answer it in my blog or newsletter.
Your books are helping me a bunch (PHP 3rd, PHP/MySQL for Dynamic WWW, and MySQL). I wasted time/$ on other authors before I realized they were poor teachers even if they were good programmers.
Anyway, whatever comes next, great. I had about four years experience in the e-learning realm and have a couple specific pedagogical ideas.
One thing that would help regardless of the content is diagrams, such as flow charts, showing the concept of creating arrays, passing variables, handling session data. Some of us are more visually oriented learners, a picture worth 1000 words, etc.
Another thing, one confusing thing about php is how it interweaves with html within one script, can “create” html , and can have conditionals on the same script as an html form. It would be great to have diagrams for how that plays out as the script is run. It is a bit of mental spaghetti at first, for me at least!
One final idea, is a convention many writers use that bugs me…
In an example saying “Now let’s create a list of items in an array… $list = array (‘item1′ , ‘item2′, ‘item3′)”..OK I may be dense but on first read on a new concept I waste time wondering if all lists need to be called $list, items called ‘item1′ etc.
Or using… “create a key with the name $key and value $value and don’t forget the variable $variable”
…just makes my head spin.
Thanks for your fine books and I look forward to more.
Dave
Hello Dave. Thanks for the suggestions and for the nice words. Much appreciated. I’ll keep your recommendations in mind (particularly about variable names, I can see how easy it is to think that they are required to be $XXX).
I am currently reading php5 and mysql 4.1. I notice the same issues I had while taking university courses. There is a distinct difference between procedural and OOP paradigms. The design concepts for both are very different.
Although, including design concepts would significantly increase the size of your texts perhaps you could address that in PHP6.
Thanks for your feedback!
Hi Larry,
very excited that you’re doing this book, you always publish great stuff.
This got me thinking about the concept of a store online, and about how business acquire customers and profits from online activity. Specifically, I was thinking of the difference between getting a customer to buy a product, and selling a product to acquire a customer. The latter assumes that the customer is the most important aspect in any transaction – not the product (although it should be a good product). Where this pertains to e-stores is in the relationship. I am currently using Magento shopping cart to create the online shopping experience for the company I am working for, and have been impressed by the features it has. Would you be able to explore the customer experience issues such as auto-responders to purchases, setting up newsletter queues to be sent to customers who purchased specific products etc.
I think that the way an online shop helps a business to communicate effectively and build a relationship with the customer has to be one of the most important aspects of its existence. I would love to see how you explore these issues and programatically develop them into the system. That is – if you agree with my thoughts on the subject.
Still, will very much be looking forward to getting a copy of the book. Thanks again for all the inspiring content you’ve given to us all,
James.
Thanks for the nice words and the feedback. Both are much appreciated! Yes, what you talk about is the kind of stuff that separates a basic e-commerce site from a real, professional one. Offering alternative and related purchases, emailing people when stuff comes in, etc. is smart business. I don’t know how much of that I’ll have room for in this book but it is a good idea to do some of that, just to let readers know what’s possible and how they’d go about it.
At this moment i am reading php 6 an mysql 5 , and i think that this is a fantastic book.
for your new book what i would like to see in it is a chapter of how to create a payment gateway as the majority of the books with this subject miss that point and for me a ecommrce website which cant take payments is lake a cake without the cherry.
well done and good luck
Thanks for the nice words on the PHP & MySQL book. I appreciate it. And, yes, a payment gateway (or two) is a definite in this book. Thanks for the feedback!
Larry when is this book coming out? I can’t wait!
Thanks for your interest! Unfortunately, the book won’t be out until Fall. I’ll keep this post and the newsletter updated as I progress, though.
Larry,
I just wanted to say how helpful your PHP 6 and MySQL book was. During my high school career, I got offered a job with a local Web Design company just designing and programming websites. Figuring out how important PHP was in this profession, I searched for hours trying to find PHP classes at the colleges in the area. I came across your book and read through that every day. Now, a year later, I can’t tell you how much I learned from it! You can never be too young to learn something you are passionate about. I just ordered your PHP 5 Advanced book today, with the anticipation of learning all about OOP PHP. Thanks again for your great books and I’ll be looking forward to this book too!
Thank you very much. I’m glad the book was so hopeful and thanks for saying so. Good luck with your PHP career!
Mark another book sold, or if you are feeling generous, I’d take a free one off of your hands in a heart-beat! As to the shopping cart, I’d like to see how a shopping cart could be truly interactive. For example, have the ability for a user to click on a box, ‘add to cart’, but the user will not be re-directed to the cart. Only when the user clicks on ‘view cart’, will he/she be directed to it. Then they can make last minute changes.
Also, how to create a cart with a subscription based payment system with paypal please. I’d like to be able to perform a payment where the user pays $1 today and starts to pay, automatically the monthly subscription cost, after the initial $1 trial period ends.
Keep up the great work. I’ve already got 4 or 5 of your books and I’ve learnt most of my php/mysql skills from your excellent tutorials!
Thanks for everything!
Frank
Hello Frank. Thanks for all of the nice words and for your interest in my e-commerce book. Much, much appreciated. I will be giving away some copies once the book is close to being published. I’ll post info about the giveaway in my newsletter when the time comes. Thanks, as well, for the suggestions. I will keep them in mind. The shopping cart update can be done with Ajax, which I’ll probably discuss.
Hi Larry,
I’d like to say how great I think your books are. I’m in the middle of the PHP/MySQL book as well as the AJAX QuickProject guide – Both are excellent and I’ve learned a ton of useful skills that I use every day now. I’m looking forward to this book as well, as e-Commerce has always interested me.
One of the things that I would be very interested in seeing is tracking of referrers. I think a short chapter on tracking where your sales are coming from (maybe an internet ad campaign, link sharing program, friend’s blog, etc.) would be great since it’s very important to know which methods are driving the most valuable traffic to your site.
Thanks and best of luck.
Rhys
Hello Rhys. Big thanks for the nice words and your suggestion for the e-commerce book. That’s something I hadn’t considered so will mull it over as I finalize the topics to be discussed. Best wishes, Larry
HI Larry,
I am looking forward to buying this book. I look for your good prose that works well in grasping the concepts.
What I would like to see in this book if there is some room, is some graphing that can show in picture form what the website did at the end of the day. Bar charts or line graphs.
Otherwise what I have read so far looks good. I thought the book would be out now. Barnes and Noble had it availavle for preorder on 12/29/09. That has been pushed back to 10/10.
Hello Mark. Thanks for your interest in the book and for your suggestions. I’ll keep those in mind. Unfortunately the book was supposed to be published Fall 2009. But due to some personal emergencies, I was not able to get to the book at all in 2009, which is why the date has been pushed back a year (and, after the original delay, a more time-sensitive book was slipped in ahead of this one). But 2010 is the year for this book and I’m eager to get to it! Thanks again for your interest and I’m sorry for the delay.