Recently I have moved my PHP websites to another host, with newer PHP version, Apache version, etc.
I have copied my files from my old host to the new host. The only thing I have changed after that copy is changing mssql_query
to db_query
, and the additional libraries installed to use this command.
I now experience the problem my dropdown values on the website that contains the characters, for example: é
or ë
, are now blank records.
This worked before the move, any idea what I can check for this problem?
Edit:
Does it has anything to do with the new connection via ODBC? Is it possible to set the charset in this connection?
function db_connect($server, $username, $password, $database, $link = 'db_link') {
global $$link;
$$link = odbc_connect("Driver={SQL Server Native Client 11.0};Server=".$server.";Database=".$database.";", $username, $password);
return $$link;
}
function db_close($link = 'db_link') {
global $$link;
return odbc_close($$link);
}
first use it in your main html file
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
or in your php file just use it
header('Content-Type: text/html; charset=utf-8');
if it is not work then use
<?php
$string = htmlentities("Your text");
?>
then show it. i think it will work