I am converting a php script to use prepared statements. But when I grab a piece of text from the database, special characters are replaced with a �.
Example:
The database contains the following text :
test 'éï' test
(verified with phpadmnin it exists)
if ( $stmt = $mysqli->prepare ( "SELECT act_omschr FROM jag_activiteiten" ) )
{
$stmt->execute();
$stmt->store_result();
$stmt->bind_result ( $DBomschrijving );
$stmt->fetch();
if ( $stmt->num_rows )
{
echo "$DBomschrijving";
}
$stmt->close();
}
As a result i get the following: test ���� test.
Any way to fix this?
Edits :
Changed my database tables to utf8_unicode_ci but it did not fix the issue. But combined with DDA's awnser below it did the trick.
$mysqli = new mysqli ( $loginURL, $dbusername, $dbpassword, $database );
$mysqli->set_charset ( "utf8" );)