Field concatenated with string in MySQL

This week I had a SELECT a little more complex to execute, that I needed to concatenate a string with a field value of the own table that I was selecting. I didn’t wanted to split my sentence in two on PHP, I was convinced that should have a way to do that without depending on PHP to pass a field value to a second query.

My first attempt was doing:

Continue reading “Field concatenated with string in MySQL”

MySQL encoding configuration

Today I was working on a CakePHP 2.1 project and when I was doing:

my result was coming with encoding errors.

As usual, I went to check de header layout, to be sure that I used UTF-8:

Then I checked the core.php to be sure it was defined with UTF-8:

Also checked the database connection at database.php to be sure it was using UTF-8:

Everything was ok on all files. What could it be then? The only possible reason was MySQL not being configured with utf-8 on table and fields…

Continue reading “MySQL encoding configuration”