I have the following problem:
I reated the following db and table:
CREATE DATABASE `mydb` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
CREATE TABLE IF NOT EXISTS `tabCCs` ( `Cod` int(10) NOT NULL UNIQUE, `Nome1` varchar(20) NOT NULL, PRIMARY KEY (`Cod`) ) ENGINE=InnoDB;
I made a batch file (.sql) to load the content:
INSERT INTO `tabCCs` (`Cod`, `Nome1`) VALUES (1,'Entrada'),(2,'Saída');
I checked via phpmyadmin and it is OK
For my WebService my PDO initiation is:
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
,PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
I also make queries (SELECT *) from my web in PDO and show ok.
$stm = $this->pdo->prepare('SELECT * FROM tabCCs');
$stm->execute();
When I add a WHERE clause, works well only for $value='Entrada' but doesn't for $value='Saída'.
$stm = $this->pdo->prepare('SELECT * FROM tabCCs WHERE Nome1 LIKE :value');
$stm->bindParam(':value', $value,PDO::PARAM_STR);
$stm->execute();
Using $value='Saída' returns EMPTY.
I know it sounds like a Collate problem, But I don't have problem to INSERT accents using PDO or problems with returns that contain accents (SELECT * return the value Saída without problem).
Any suggestion? I looked all over internet and only find problems about exibition problems or incomplete inserts, but none for queries.
Thanks in advance!