PDO bindParam更改我的字符串

I've the following code to insert some data into my database:

$query = "INSERT INTO `questions`(`title`,`content`,`set`,`date`) VALUES(:title,:content,:set,:date)";
    $stmt = $db -> prepare($query);
    $stmt -> bindParam(':title',$title,PDO::PARAM_STR);
    $stmt -> bindParam(':content',$content,PDO::PARAM_STR);
    $stmt -> bindParam(':set',$set,PDO::PARAM_INT);
    $stmt -> bindParam('date',$date,PDO::PARAM_STR);
    $stmt -> execute();
    echo '<script>alert("שאלה נוספה בהצלחה");</script>';

The problem is, whenever I view the inserted information in the DB, it turns to weird string such as: &#1489;&#1506;&#1489;&#1512;&#1497;&#1514; I have no clue why it's happening!

P.S. If I insert English string, it's all right. It shows as a proper english in the DB. It happens when I insert data in my language.

After inspecting it for a while, I found out what was the problem.

The form that I got the input from wasn't inside an HTML tags because it was a quick and very simple interface.

After giving that a thought, I tried to do the form inside proper HTML tags. I've enclosed the <form> tag in this:

    <html dir="rtl">
    <head>
    <title>Insert a new question</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> // important line
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  </head>
 <body>
<!-- form here -->
</body>
</html

After doing that, the input given was a proper Hebrew letters instead of the HTML entity code.

Hope this will help someone.

It may be a problem with the character sets and collation. You may need them set to UTF-8

http://en.wikipedia.org/wiki/UTF-8

Remove the PDO::PARAM_STR from your bind and use this in your code once :

mb_internal_encoding("UTF-8"); //for utf unicodes
internal_encoding("your unicode"); //

OR

default_charset = "your unicode";

whenever I view the inserted information in the DB, it turns to weird string such as: &#1489;&#1506;&#1489;&#1512;&#1497;&#1514; I have no clue why it's happening!

I have.
These symbols has absolutely nothing to do with database.
It's HTML encoding and mysql will never ever encode your data this way.

It's some other software that converts your data before adding it to DB. You can easily verify it just by outputting these characters (NOT rendered by browser, of course). Most likely its some sort of "all-sanitize" function which you definitely have to get rid of.