php - Escaping quotes before MySQL -


here have script validate description users pass:

if(strlen($_post['descriprtion']) >250) {     //some error code here } else {  $description = $mysqli->escape_string(htmlentities(trim($_post['description']))); } 

now, test description i'm testing. give me when print out page:

as can see, there's black slash before single quote.

i considering using stripslashes(), should use it?

use stripslashes() when want echo variable.

echo $var;                 // --> i\'m testing. not funny. echo stripslashes($var);   // --> i'm testing. not funny. 

working dmeo


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -