sanjay chaudhary
sanjay chaudhary

Reputation: 81

I have to read and display gujarati font stored in database

<?php
    //set charset:utf-8 //for json, is it right way to do it;
    header('Content-Type:application/json; charset:utf8'); 

    $mysqli = new mysqli('localhost','root','','hospital'); 

    $myArray = array();
    if ($result = $mysqli->query("SELECT * FROM tips")) {

        while($row = $result->fetch_array(MYSQL_ASSOC)) {
            $myArray[] = $row;
        }
        echo json_encode($myArray);
    }

    $result->close();
    $mysqli->close();

?>

Upvotes: 2

Views: 1452

Answers (1)

mukesh_patel
mukesh_patel

Reputation: 21

You should set the field's collation to "utf8_bin" so that mysql will store the data in gujarati properly. and also you need a proper gujarati font to apply a css class font-family propery

Upvotes: 1

Related Questions