mysql_real_escape_string not working on different servers
function, mysql, php
Solution
`mysql_real_escape_string` needs an existing MySQL connection. No connection, no escaping.
Problem
I have this strange problem. I have this script: ``` echo $comment_content = $_POST['comment_content']; echo $comment_content = mysql_real_escape_string($comment_content); ``` When I run it on my website server, it outputs the value only 1 time (not the second one), but when I run it anywhere else, it outputs right (2 times). However, I use function `mysql_real_escape_string` many times (on the same site) and it never happened before. This is the whole code, nothing more. Anyone ever had the same problem? If yes, how did you fix it? edit: the `<?php ?>` tags also there ofc.