prevent SQL injection in PHP? 1

prevent SQL injection in PHP?

$str = "";
echo htmlentities($str);

Here is what the above code is Doing:
1. We are creating a string variable called $str and assigning it a value of
2. We are then using the htmlentities() function to convert the string to HTML entities.
3. We are then printing the string to the screen.

The output of the above code will be:

<script>alert('Hacked')</script>

Similar Posts