Reputation: 3
how to fetch data using zend db select if data is in "Portuguese"
?
"Amapá - AP" Having this text in database. "á" is creating problem.
I am using the query:
SELECT * FROM tablename WHERE state_name LIKE 'Amapá - AP'
It runs properly in database but create create problem with zend db select.
Could anyone suggest a solution?
Upvotes: 0
Views: 100
Reputation: 130
Whenever you need to handle special characters with Zend_Db then you should set the charset type "utf8". To set the charset type utf8, add following property in your config file:
resources.db.params.charset=utf8
now everything will work fine.
Upvotes: 1
Reputation: 594
Because you have to bind params to query
your query should be
$query = $mysqli->prepare("SELECT * FROM tablename WHERE state_name LIKE ?");
$searchFor = "Amapá - AP";
/* or
$searchFor = "%Amapá - AP%";
$searchFor = "%Amapá - AP";
*/
$query->bind_param("s",$searchFor);
For more details and examples about using bind_params find here
Upvotes: 0