php - SQLi Protection From User Input Text -
this question has answer here:
- how can prevent sql injection in php? 28 answers
i put manual sqli parameter checks in place (i.e check if input valid email).
although in case, need put user message db
how work?
i tried code, whole input gets erased somehow.
<?php $text = "hello world"; echo "$text "; $text = stripslashes($text); $text = mysqli_real_escape_string($text); echo $text; ?>
thannk you!
need linking parameter mysqli
like
$text = $db->mysqli_real_escape_string($text);
example:
//escaping characters $db->real_escape_string('this unescaped "string"'); //there alias function can use shorter , less type: $db->escape_string('this unescape "string"');
Comments
Post a Comment