S
S
Seth262015-06-17 09:40:16
PHP
Seth26, 2015-06-17 09:40:16

The appearance of strange characters when connecting to the database, what could be the reason for this?

<html>
<head>
<title>
Работа с базой данных
</title>
</head>
<body>
<?php
include('db.php');
$query= mysql_query("SELECT * FROM articles");
$row= mysql_fetch_array($query);
echo $row['title'];
?>
</body>
</html>

FILE db.php
<?php
$host="localhost";
$user="root";
$paswword="";
$db="new_db";
$connection= mysql_connect($host,$user,$password);
mysql_set_charset("utf8",$connection);
if(!$connection)
{
exit(mysql_error());
}
if(!mysql_select_db($db,$connection))
{
exit(mysql_error);
}
?>

I changed the encoding, but it still appears

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2015-06-17
@Seth26

1) stackoverflow.com/questions/12859942/why-shouldnt-...
2) Check db encoding

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question