Larry Ullman

Translating Geek Into English

Debugging Database Operations in Yii

Whenever you begin working with a database, you introduce more possible causes of errors. Thus, you must learn additional debugging strategies. When using PHP to run queries on the database, the problems you might encounter include:

  • An inability to connect to the database
  • A database error thrown because of a query
  • The query not returning the results or having the effect that you expect
  • None of the above, and yet, the output is still incorrect

On a non-framework site, you just need to watch for database errors to catch the first two types of problems. There’s a simple and standard approach for debugging the last two types:

  1. Use PHP to print out the query being run.
  2. Run the same query using another interface to confirm the results.
  3. Debug the query until you get the results you want.

When using a framework, these same debugging techniques are a little less obvious, in part because you may not be directly touching the underlying SQL commands. Thankfully, Yii will still be quite helpful, if you know what switches to flip.

This is an excerpt from Chapter 8, “Working with Databases,” of " The Yii Book".

What Third-Party Library Do You Integrate with Yii?

I’m looking ahead to writing Chapter 20, “Working with Third-Party Libraries,” of " The Yii Book" (I’m currently writing Chapter 19), and was wondering what people wanted me to specifically demonstrate. Originally, I had intended to use the Zend Framework as my example. I like how ZF components can be easily used on their own, and I’d frequently used ZF with my own Yii projects. Lately, I’ve been thinking about using Symfony in the chapter. I’ve not touched Symfony yet myself, but have heard good things. Of course, the examples don’t have to use frameworks; they could use any type of library.

So as I’m gearing up to write that chapter, I was wondering what third-party library you integrate with Yii? Or, what third-party library would you like to integrate with Yii? Or, what third-party library would you like to see me integrate with Yii?

Any and all suggestions and feedback are most welcome. Thanks!

“Going Big” With a Website

I’ve created a three-part series posted as a guest blogger on the site of my hosting company, ServInt. The series is titled “‘Going Big’ With a Website”, and is based upon a series of newsletters I put out a couple of months back. In the series, I attempt to explain how one should navigate the process of having no site, to having a site, to having an active site, should you be so fortunate. The series isn’t so much about the X’s and O’s (e.g., caching, using gzip, Apache vs. nginx, and so forth), as it is about general philosophies you need to consider in order to best use your limited resources (although there are a few specific recommendations in there).

"How to decide when to work for free" by Penelope Trunk

On August 17, 2013, at the Northeast PHP conference in Boston, I gave a new presentation titled " How To Get There". This was a motivational-like presentation, which is virgin territory for me, but I think it turned out well. In the talk, I recommend 21 behaviors and attitudes one should have in order to succeed, in order to achieve one’s goals. The tl;dr version comes down to this:

Be honest. Work hard. Never stop learning.

This is common sense, yes, but often it’s the things that should go without saying that most need to be said.