How to Create Blog Excerpts with PHP


Ever visited a blog, and noticed that each posting’s overview only contained a hundred characters or so, which is then followed by “…”? Ever wondered how to do that yourself? It’s not quite as easy as you might think. What if character number 100 occurs in the middle of a word? Do you want to display half of a word on the page? Of course not. In this video tutorial, I’ll show you how to compensate for this, as well as a host of other neat little things, like working with MySQL’s LEFT() function, using PHP’s strrpos, and substr, creating the beginning’s of an actual blog, and more.


What You’ll Learn

  • Use MySQL’s LEFT() function to create temporary columns
  • Use PHP prepared statements to query the database
  • How to create an “excerpts” section for your blog
  • PHP’s strrpos and substr functions
  • The process of creating the beginnings of a blog

Leave a Reply

Your email address will not be published. Required fields are marked *