This is my third post in a series in which I’m rewriting the stored procedures used in my “Effortless E-Commerce with PHP and MySQL” book as standard PHP and MySQL. Although stored procedures offer lots of benefits over standard PHP-MySQL logic, not everyone has an environment that supports stored procedures, so I’m writing these posts to help out those readers. [intlink id=”2084″ type=”post”]In my first post[/intlink], I rewrote the examples from Chapter 8, “Creating a Catalog”. Those examples are really simple, running only basic SELECT queries. [intlink id=”2151″ type=”post”]In the second post[/intlink], I presented an alternative version of the stored procedures—and the PHP scripts that call them—for Chapter 9, “Building a Shopping Cart.” Those procedures aren’t too complex either. In this post, I’ll rewrite the stored procedures and update the PHP scripts that call them for Chapter 10, “Checking Out.” This chapter has the most complicated—and important—stored procedures, so the PHP scripts will need to be reworked more than in the other chapters. All three chapters are from the third part of the book, in which an e-commerce site is developed for the sake of selling physical products (viz., coffee). Continue Reading…
Archives For ecom
This is my second post in a series in which I’m rewriting the stored procedures used in my “[intlink id=”1578″ type=”page”]Effortless E-Commerce with PHP and MySQL[/intlink]” book as standard PHP and MySQL. Although stored procedures offer lots of benefits over standard PHP-MySQL logic, not everyone has an environment that supports stored procedures, so I’m writing these posts to help out those readers. [intlink id=”2084″ type=”post”]In my first post[/intlink], I rewrote the examples from Chapter 8, “Creating a Catalog”. Those examples are really simple, running only basic SELECT queries. In this post, I’ll present an alternative version of the stored procedures—and the PHP scripts that call them—for Chapter 9, “Building a Shopping Cart.” Both chapters are from the third part of the book, in which an e-commerce site is developed for the sake of selling physical products (viz., coffee). Continue Reading…
In this edition…
- About The Previous Newsletter
- About This Newsletter
- On the Web => Myows | Free Online Copyright Protection
- On the Web => URL Rewriting for Beginners
- On the Web => Chapter from “Effortless E-Commerce with PHP and MySQL”
- On the Blog => More Links About HTML5
- On the Blog => Rewriting the E-Commerce Stored Procedures
- Q&A => What do you think the future looks like for Flex developers?
- Q&A => Would you ever consider doing video tutorials?
- What is Larry Thinking? => The Evolution of a Newsletter
- Book Giveaway => “Effortless E-Commerce…” and “Effortless Flex…”
- Larry Ullman’s Book News => “Effortless E-Commerce”, “PHP for the Web”, and More!
About the Previous Newsletter
So the first thing to acknowledge is how the last newsletter turned out…As I mentioned at the beginning of that newsletter, it was the first newsletter sent using a new system (specifically, a commercial WordPress plug-in named Newsletter Pro. To start, I wrote the entire newsletter, entered it into the new system, and sent myself a test newsletter. In that test newsletter, I tested all the links. So far, so good. Then I thought: I should add internal links so “In this edition” list at the top is anchored to the articles below. Naturally, being such a minor detail, I didn’t bother to test this again. And that’s where I went astray! Always test again. Always. As many of you discovered, those links didn’t work at all (the others in the newsletter did, or should have).
The cause of the problem is this: one of the features of Newsletter Pro is the ability to track links. I thought it might be interesting to use such a feature. Unfortunately, as I found out, the system is not smart enough to distinguish between absolute URLs and internal anchors. So there’s that then.
Second, I forgot to include an unsubscribe link in the previous newsletter. That’s not the end of the world, but an unsubscribe link should be prominent (in some countries, that’s a legal requirement, too).
Third, as some of you found out, the PDF links in the E-Commerce-related posts on my Web site weren’t working (well, not until I discovered this myself and corrected the issue). This had to do with how WordPress handles relative links (i.e., not consistently well).
All in all, not so good on my part. My apologies for the mistakes and the lack of professionalism. To be fair, I think of the newsletter as something that should be colloquial and casual, but still… I’ll try to do better. Speaking of which…
About This Newsletter
This is the first newsletter using a new, new system! Considering the problems I had with the previous newsletter, and because of secondary concerns about the Newsletter Pro plug-in (more on this later in this edition), I decided to re-investigate the mailing list options. I’m now using commercial email marketing software from Campaign Monitor. As you can hopefully already tell, the end result should be much more professional. Also, towards that end, I believe this newsletter should be easily viewable in plain text, if that’s your preference.
As for this edition’s content, there are links to some good stuff, including an entire chapter from my “Effortless E-Commerce with PHP and MySQL” book available for free online. I also answer a couple of questions and talk in depth about how this newsletter has evolved over the years. If that’s not enough to pique your interest, you may want to check out the book giveaway. There are three titles available!
As always, thanks for reading and let me know what questions, comments, or issues you may have. Especially the issues, because new systems bring new problems!
On the Web => Myows | Free Online Copyright Protection
In previous newsletters, I’ve talked about copyright issues with respect to writing, Web sites, and other content. You don’t actually need to indicate that anything is copyrighted in order to protect it, but having proof of authorship is critical in pursuing copyright violations. Towards that end, one solution is Myows, a free, online copyright management and protection system. I haven’t personally used it but expect that some of you will appreciate what Myows offers.
On the Web => URL Rewriting for Beginners
One of the most important technologies people need to familiarize themselves with after learning dynamic Web development is the Web server itself. Whether it’s Apache, IIS, Abyss, or whatever, harnessing the power of, or simply being able to properly configure, the Web server is a crucial skill set. Among that set is URL Rewriting. There are a number of reasons to use URL Rewriting, the most common being the desire to change a URL from something technically useful, such as www.example.com/browse.php?cat=2 to something semantically useful, such as www.example.com/browse/Hard+Drives/. To get started, check out this nice tutorial on the subject.
On the Web => Chapter from “Effortless E-Commerce with PHP and MySQL”
Peachpit Press, publisher of my book “Effortless E-Commerce with PHP and MySQL”, has posted a chapter from the book on their Web site (technically New Riders is the publisher, but Peachpit owns New Riders). The posted content represents the entire Chapter 4, “User Accounts,” which is the second chapter in Part Two: Selling Virtual Products. The posted content covers how user accounts will be managed in the site (in the particular example, only paid, registered users may access content). The material walks through the creation of several helper functions, then develops an entire registration, logging in, logging out, and password management system. The chapter concludes with some security improvements one could make.
On the Blog => More Links About HTML5
A couple of weeks ago I posted a slew of links that I have come across involving HTML5. If you’re curious about the subject (and if you do any Web development, you really should be), check them out.
On the Blog => Rewriting the E-Commerce Stored Procedures
In the second e-commerce example in my “Effortless E-Commerce with PHP and MySQL” book, stored procedures are used for all of the public-side database-related functionality. This includes: the displaying of product categories, specific items, and sale items; cart and wish list management (adding items, updating quantities, removing items); and order submissions. However, not everyone can use stored procedures, in particular those on some shared hosting environments.
One reader recently said (in the forums) that they couldn’t use stored procedures with their host, so I volunteered to rewrite some of the stored procedures as standard PHP and MySQL. In the first post towards that end, I rewrote the procedures, and corresponding PHP scripts, from Chapter 8, “Creating a Catalog”. Over the next month or so, I’ll rewrite the stored procedures, and the PHP scripts that use them, from Chapters 9 and 10.
Q&A => What do you think the future looks like for Flex developers?
Rob asked this question, specifically referencing the “Apple/Flash logjam”. In other words, with Apple being difficult (to use a polite word) about Flash (not) running on its mobile devices, how does this impact Flex/Flash Builder developers? This is a good question.
Without opining too much on the Great Apple/Adobe War of ‘10, I feel there’s got to come a time when Flash will run on Apple’s devices. Perhaps Adobe will work some with Apple to make Flash run more reliably. Perhaps Apple will cave to pressure (or Department of Justice investigations) and change their position. Probably both will happen and then some. But eventually Flash will run on iPods, iPhones, and iPads. This I believe. And Flash is already available on non-Apple devices, which I think constitutes a larger percentage of the overall market (e.g., even though no individual Android phone sells better than the iPhone, there are more Android-based phones sold than iPhones). The next version of Flex is adding extra features specifically targeting the mobile market, so Adobe is clearly not laying low on that front.
But Flash on mobile devices is just one consideration. While there is increasing interest in what can be done through mobile devices, the fact is that non-mobile devices are still a vastly larger market, and I can’t see that changing for some time. Flash has a huge share of the video market and it’s one of the very few plug-ins that comes included with most browsers. (In fact, Google and Adobe have been working on a version of Flash that’s more tightly integrated with Chrome, even updating Flash automatically when a new version comes out.)
And although it’s a smaller market than Web-based applications, you can use Flex to create cross-platform desktop applications via Adobe AIR. I’m a pretty big fan of this feature, but I admit I’m a bit of an outlier on this particular topic.
So, in short, I’m not particularly concerned about the future for Flex developers. Flex is a very good product with lots of uses and Flash has an extensive user base. Even Apple’s stubbornness or the forthcoming HTML5 (which will be broadly supported when exactly?) can’t change that.
Q&A => Would you ever consider doing video tutorials?
Parker asked this question. I acknowledge that video tutorials are an excellent way to learn and are becoming increasingly more common, but it’s just not my thing. I think of myself as a writer, not a video instructor (or voice-only screencasts, for that matter). Coincidentally, Peachpit Press wanted me to add little video clips for the electronic version of my “PHP for the Web: Visual QuickStart Guide” (4th Edition) and I said “No” to that as well. I appreciate the interest, however!
What is Larry Thinking? => The Evolution of a Newsletter
Largely because of the changes to my Web site (going from www.DMCInsights.com to www.LarryUllman.com and changing from a largely custom system to one based upon WordPress), I’ve lately been thinking about the evolution of this newsletter. As I’ve said many times over by now, I’m not a marketing type of person. Although I’d love it if everyone in the world bought a copy of everyone of my books (why not two copies?), I’m not a salesman. I just don’t want to talk people into buying anything. In my mind, I write what’s hopefully a good book and people will buy it because it’s good. But just as creating a great Web site doesn’t mean people will go visit it, writing a good book doesn’t necessarily mean it will sell. So I believe this newsletter started off, in 2007, as a marketing tool, in part. Still, I never wanted it to be a “Buy! Buy! Buy!” kind of thing, but rather “here’s some other information you might appreciate and oh, by the way, here’s what’s going on with my books”. Although a number of the references in these newsletters are book related, I’ve always put the “Larry Ullman’s Book News” section last, so as not to be overbearing. That’s my thinking with the newsletter, anyway, but it’s interesting to see how it’s changed in three years.
When I began this newsletter, I didn’t think much about where it would go or how popular it might become. For most of the past three years I used the free PHPList. While not great, PHPList is pretty good, especially for being free. It handles subscriptions, both HTML and plain text versions, and, in theory, bounces. Unfortunately, the subscription form required that the user click a link to go to another page (admittedly, I could have changed my design to correct this flaw). Also, I had to maintain two template versions of the site, as PHPList couldn’t integrate into my other code. (When you add in the fact that the blog was separate from the main site, the DMC Insights, Inc. site had three sets of template files to maintain, all to create a similar look. Ugh!)
When I recently moved to a complete WordPress solution for my site, I wanted something that could be integrated into WordPress. I got that with Newsletter Pro, a commercial plug-in (it’s only like $20). Newsletter Pro integrated perfectly with WordPress and by placing a subscription form front and center, there were frequent new subscribers. Then I went to use the plug-in to send a newsletter for the first time and had the aforementioned links problem (what’s the HTML entity for egg on one’s face?) Granted, another review of the newsletter on my part would have caught that, but I was also having a hard time figuring out how to customize the newsletter’s HTML template. Forced into sending HTML-only email, a custom template became a pseudo-requirement in my mind. But the developer of the Newsletter Pro plugin isn’t great about documentation or support (even though it’s a commercial product), so I suspected the template customization was one of several significant hurdles to come. Plus the Newsletter Pro system didn’t seem to handle bounces properly and the spam filters for some users were blocking the content (even though they were subscribers). I decided to look into alternative systems.
In the process of researching how to make HTML emails look sharp across the variety of email clients, I came upon Campaign Monitor, which provides email marketing software. Unlike the solutions I’ve used thus far, it’s a commercial route, but perhaps it’s time for that, if only for a bit more professionalism and peace of mind. It’s going to cost me maybe $20/month to send out one newsletter per month, which seems fair enough. And because of spam protections and the like, the Campaign Monitor system should have better luck getting my newsletter into everyone’s inbox. Campaign Monitor will send out both HTML and plain text versions, and I can still use a WordPress plugin to tie the subscription into my main site. As I’ve said many times over, I hate spending money, but with over 1,200 subscribers, I can’t afford to go the cheap route anymore. And if you’re curious how big the newsletter has become: you’re one of over 1,200 subscribers! I don’t know that that is a lot, but it seems like a grand number to me.
Of course, the key to a good newsletter is the content. In creating the new version of my site, I imported all 32 previous newsletters into WordPress. The first thing that struck me was how long they’ve become! There’s a classic quote from Blaise Pascal that, translated into English, goes “I have made this letter longer only because I have not had the leisure of making it shorter.” Which is to say it takes time to be concise. That is part of the issue for me. Another factor is that the newsletter used to be one main topic, plus maybe a paragraph on three or four others. Now the newsletter is one main topic, plus a paragraph on three or four others and a couple of paragraphs on three or four more. But I’m not getting any complaints and as I’m only sending out one newsletter per month, longer makes more sense (i.e., hopefully there’s something in each newsletter for everyone). On the other hand, perhaps if I were to send them out more frequently, there’d be less I feel the need to say in each.
In terms of how I produce the newsletter, I originally created it in my trusty text editor. I’d look at my email, my browser’s bookmarks, my blog postings, and so forth, compile a random collection of thoughts and questions, write it out, add HTML, etc. For 30 newsletters, that’s the “system” I used. A couple of newsletters back I started using Scrivener, an excellent word processing application for Macs. One benefit of Scrivener is that it organizes projects so that I can have both my research (i.e., my collection of potential topics) and my writing in the same application, saving me from switching from program to program. Once a draft was complete, I’d still output the text and open it in my programming text editor where I could add the HTML. For this newsletter, I’ve finally started using Markdown, a markup syntax supported by Scrivener and many other applications (I may write my JavaScript book using Markdown or Multimarkdown, too). With Markdown, I use very simple symbols and formatting—but absolutely no HTML tags—and can still output HTML. I think adopting Markdown is going to save me a lot of time and if you do any writing yourself that’s intended for one or more destinations, it’s worth your time to check it out, as well.
So looking back, what have I learned in three years? One, my word do I have a lot to say! Two, I’m extremely fortunate to have the following I do (I hate to use that word, but I couldn’t think of a better, less egocentric one offhand). Third, the odds of getting questions and comments goes up dramatically when I’m giving away books! (Although with 1,200 subscribers, it’d be overwhelming if everyone replied to every newsletter.) Fourth, when you don’t really have a long-term plan, you can’t be too surprised by where you end up. Fifth, sometimes spending a little money is worth it. And sometimes not! Finally, and most importantly, the evolution of the newsletter has been a good reminder to me that you have to be willing to constantly reconsider how you do things. The right solution today is virtually guaranteed not to be the best solution tomorrow. Thinking otherwise is how you get left behind.
Book Giveaway => “Effortless E-Commerce…” and “Effortless Flex…”
You must be subscribed to the newsletter in order to qualify for the book giveaway.
Larry Ullman’s Book News => “Effortless E-Commerce”, “PHP for the Web”, and More!
As mentioned in my previous newsletter, five chapters from my “Effortless E-Commerce with PHP and MySQL” book have extra content, available as PDFs. I’m also writing some extra code and posts, such as showing how the stored procedures used in the book’s second example would be written using standard PHP and MySQL (mentioned above). You can find all of this and any other extra that come up specifically for that book through www.LarryUllman.com/tag/ecom/.
On a similar note, I just agreed to write four articles and five blog posts for Peachpit Press’s Web site, all supporting the “Effortless E-Commerce with PHP and MySQL” book. The blog posts will discuss the five most important security criteria for e-commerce sites, similar to a question that I answered in a blog comment. The four articles will explain how to implement extra features in an e-commerce site. The specific features are: adding customer reviews, product recommendations, an Ajax-enabled shopping cart, and an Ajax-enabled product rating system. I’m writing these over the next month and they’ll go online in early 2011. I’ll post links to them on my Web site as they go live.
I just completed Chapter 7 of my next book: the fourth edition of “PHP for the Web: Visual QuickStart Guide”. Largely the revision will fix any minor problems, update the code for the latest version of PHP, and add a “Review and Pursue” section to the end of each chapter. That section will consist of both questions (based upon the chapter’s content) and prompts for what else the reader can try using the information they just learned. If there’s room, I’m thinking about adding one short example chapter, similar to those at the end of the PHP and MySQL book.
My self-published JavaScript book is still on the docket and should be actively pursued starting in January. I have a couple of months before I’ll need to work on the fourth edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide,” so I’ll try to do as much as possible on the JavaScript book in that interim.
In the second e-commerce example in my “Effortless E-Commerce with PHP and MySQL” book, stored procedures were used for all of the public-side database-related functionality. This includes: the displaying of product categories, specific items, and sale items; cart and wish list management (adding items, updating quantities, removing items); and order submissions. As I write in the book, stored procedures offer tons of benefits, the most critical being:
- Greatly improved security
- Better performance
- Compartmentalization of code (i.e., adherence to an MVC approach)
However, not everyone can use stored procedures, in particular those on some shared hosting environments. One reader recently said (in the forums) that they couldn’t use stored procedures with their host, so I volunteered to rewrite some of the stored procedures as standard PHP and MySQL. In this post, I’ll rewrite the procedures, and corresponding PHP scripts, from Chapter 8, “Creating a Catalog”. Continue Reading…
Peachpit Press, publisher of my book “Effortless E-Commerce with PHP and MySQL”, has posted a chapter from the book on their Web site (technically New Riders is the publisher, but Peachpit owns New Riders). The posted content represents the entire Chapter 4, “User Accounts”, which is the second chapter in Part Two: Selling Virtual Products. The posted content covers how user accounts will be managed in the site (in the particular example, only paid, registered users may access content). The pages walk through the creation of several helper functions, then develop an entire registration, logging in, logging out, and password management system. The chapter concludes with some security improvements one could make.