I have following piece of code which posts some data into database:
$post = trim( $post );
$post = htmlentities( $post, ENT_QUOTES, null, false );
$statement = "INSERT INTO table (row) VALUES (:message)";
$prepared_posts = $pdo->prepare( $statement );
$prepared_posts->execute( array( ':message' => $post ) );
I have MySQL version 5.1.47-community
on both localhost and staging / production server, but I'm getting different output on both of them. On localhost I'm running PHP 5.3.2
, production server has PHP 5.2.14
.
If I'm trying to post sentence that's "ok"
, on production it saves that\'s \"ok\"
, localhost produces correct that's "ok"
.
What could be causing this? Could it be some MySQL setting? I also tried using mysqli
instead of PDO
and it does the same thing.