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.

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

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.

ok , Thanx for help :)

You are welcome. If this is it (no more questions) please mark as solved.