What are the potential pitfalls of using multiple instances of mysql_escape_string in PHP code, as seen in the provided example?

Using multiple instances of mysql_escape_string in PHP code can lead to double-escaping of characters, which can result in incorrect data storage or retrieval from the database. To solve this issue, it is recommended to use a single instance of mysql_escape_string on the input data before storing it in the database.

// Example of using mysql_escape_string correctly
$input = "It's a test";
$escaped_input = mysql_escape_string($input);

// Use $escaped_input in your SQL query to store in the database