PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I escape data that is going into a database?


There are various ways to do this. If you know for sure that you need to escape your data, one way is through using the addslashes function, like this:
<?php
$mydata 
"hello I'm great"
$mydata addslashes($mydata);
//now contains: hello I\'m great
?>



More forms PHP Questions

How do I check that a valid email address is entered?
How can I access information sent through GET on a form?
What are magic quotes?
How can I access information sent through POST on a form?
How do I remove escape characters from data?