使用php从mysql数据库存储和检索数据的安全和快速方法

I have seen a lot of function to store data in database using php which are following :

(1) Serialization used by many websites like wordpress etc. and it seems good but most of forum said it not a good way to store data so why these forum use serialization to store data?

(2) Json is another way to store data.

(3) mysql_real_escape_string is another way to store data.

(4) addslashes use with stripslashes. but addslashes insert data with slashes which is not good in my opinion because it violet database.

(5) we can also use php function to sanitize data like get_magic_quotes_gpc().

Please explain what is advantage and disadvantage of their and when should they use.

php PDO and Stored Procedures are the canonical 'best' way to do mysql data access.