Since you're updating this line anyway, might as well make it compliant with spacing as well. eg:
```php
echo ' data-image-name=' . htmlspecialchars( $row['title'] ) . ' data-image-key='. htmlspecialchars( urlencode( $row['key'] ) );
```