In my code i am using addslashes to escape certain characters while inserting them into the database and when i send some information out i use stripslashes to remove those slashes, the situation is stripslashes function removes all the slashes so if i need to send any string which has backslashes those also get removed. How can i retain those required slashes.
Any help will be greatly appreciate.
You might want to try using mysql_real_escape_string. You don't have to unescape it, and it is safe for database use.
Better yet, use prepared statements
You can try using PDO prepared statements when inserting to database so you don't need to worry about escaping anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With