Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > PHP/MySQL/Scripting

Creating a Customer Review System in PHP and MySQL

  • Print
  • + Share This
Adding a system of product reviews to an e-commerce site is one of many ways you can encourage customers to make a purchase. Author Larry Ullman shows you how in this article, including discussion of common features, definitions of the underlying database tables, and the actual PHP code and SQL commands.
From the author of

The success of an e-commerce site depends not just upon what the site is selling (and at what price) but also upon what other features the site offers its customers. Everything an e-commerce site does should make customers more comfortable shopping there. Towards that end, adding a customer review system, where users can rate items they have previously purchased, will help other customers make educated decisions as to what they should buy. It’s a common and extremely useful feature for any e-commerce site, and one that’s not too hard to implement.

Identifying the Goals

Before getting into any code, it’s prudent to decide how, exactly, the customer review system should work. At the very least, a review consists of both a textual description and a rating, often on a scale of 1 to 5. Beyond those two requirements, there are many ways of customizing the system for the site and your tastes. Some sites restrict reviews to registered users. Other sites allow anyone to anonymously add a review. Which route you choose will depend upon, for starters, whether or not the site otherwise uses registered users.

A feature that I like to see in review systems are “Is this review helpful?” prompts. Other users can click Yes or No, allowing more useful reviews to bubble up to the top. Whether or not you integrate that feature, you probably should have some method for reporting inappropriate reviews. Even if your system has a human personally approve every review before it goes live, there may be reasons to report not obviously inappropriate reviews (e.g., a review of my first book suggested that a chapter on a specific subject was terrible; the book didn’t actually have a chapter on that subject).

Finally, some systems, like Amazon.com (which does just about all things e-commerce as well as a site can), allow comments on reviews. Again, you’d need to decide whether or not to limit comments to registered users. And, of course, you may then want to add the ability to indicate whether or not a comment was useful and users should be able to report an inappropriate comment.

  • + Share This
  • 🔖 Save To Your Account