Fix php notice.

A php notice "Undefined index" is generated if the table doesn't have a primary key.

This patch "fixes" the notice. (An exception is still thrown informing the user about the issue.)