How to output latvian symbols?

http://re-books.infinityfreeapp.com/index.php

Error Message

I want to get latvian words from my database on index page, but it returns “?” or something like that when i want to fetch it. What do I do?

Maybe these?


Also do this:

4 Likes
<?php
/* Connect to a MySQL database using driver invocation */
$dsn = 'mysql:dbname=testdb;host=127.0.0.1';
$user = 'dbuser';
$password = 'dbpass';

$dbh = new PDO($dsn, $user, $password);

?>

I were trying to do like this, but get an error

The host name is a URL found in the client area.

And what is the error you are getting?

Also, how does connecting to a database have to do with Latvion characters, I am a bit confused.

4 Likes

Oh, I’m sorry that i didn’t include that, after dbname i’m writing ;charset=utf8mb4 as said in guide from here: PHP: PDO_MYSQL DSN - Manual

$dsn = 'mysql:dbname=...;charset=utf8mb4;host=...';
    $user = 'epiz_33247847';
    $password = 'RENOVEDBYMOD';

    $conn = new PDO($dsn, $user, $password);

    if (!$conn) {
        die("Connection failed: " . mysqli_connect_error());
    }

I believe these are the errors

image

Check this out

3 Likes

This code helped me to set charset i need
`
$conn = new mysqli(‘localhost’, ‘root’, ‘’, ‘re-books’);

/* Set the desired charset after establishing a connection */
$conn->set_charset('utf8mb4');

//printf("Success... %s\n", $conn->host_info);

`

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.