0

i m working on a linux server and my part of the code is this-

$post = mysql_real_escape_string($_POST['post']);


echo $post;

but my $post variable is not getting printed. and when i print $post variable without using mysql_real_escape_string function ,it is working. i.e.

echo $post;

its a weird problem . can anyone please tell me the reason behind it????? I have checked the availability of the mysql_real_escape_string function and this function exists on the server.

3
Contributors
4
Replies
6
Views
5 Years
Discussion Span
Last Post by broj1
0

Hi,
Maybe you use mysql_real_escape_string() before connecting to mysql database.
This function can be used after the connection is opened.

0

Since this function returns false in case of error you can use it this way:

$post = mysql_real_escape_string($_POST['post']) or die('ERROR: ' . mysql_error());

If there is an error you will get some description about it. But as MarPlo stated above the link to the database has to be established first, since mysql_real_escape_string function relies on it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.