在mysql数据库中存储页面内容

I am developing CMS in core php5, in which i am adding pages,like WordPress.

but actual Problem is that, page contents contain special characters like, single Quote(') which can not be inserted in mysql database.

I used PDO

http://pk1.php.net/manual/en/pdo.prepare.php

also this function

 $add_to_database = mysql_real_escape_string($contents)

but still the Problem is same, when i fetch contents on front the special characters creating Problem,

please Help me

thanks

base64_encode is the Best Solution I think

$contents  = base64_encode($_POST['page_contents']);

Query will be

INSERT INTO your_table VALUES('".$contents ."');

when fetching

$page_contents = mysql_fetch_array($contents);

echo base64_decode($page_contents['content']);

you have 2 ways one is html entities and another one to use base64_encode

$contents  = htmlentities($_POST['page_contents']);
$contents  = base64_encode($_POST['page_contents']);