I’m in a situation where I need to update some rows in a table named “matrículas’. The query looks something like this:
UPDATE `matrículas` SET...
When I run this query in my SQL program (HeidiSQL) directly, it executes without problems. When I do it in PHP via a PDO object, I get the following error:
SQLSTATE[HY000]: General error: 1300 Invalid utf8 character string: 'matrxEDculas'
My PDO object is set up like this:
$db= new PDO( 'mysql:host='.$credentials['host'].';dbname='.$credentials['dbname'].';charset=utf8', $credentials['user'], $credentials['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8") ); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
The actual update is done by taking the above query and doing this:
$query = $this->db->prepare($sql); $query->execute($params);
Both the table and the database were created using the
Any ideas what I’m doing wrong? btw, I’m currently testing in Windows in case that has anything to do with it…