-4
$intro=mysql_real_escape_string($_POST["intro"]);
$description=mysql_real_escape_string($_POST["description"]);

If i post the any special character value it is not stored properly.

fracz
  • 20,536
  • 18
  • 103
  • 149
Bharath
  • 23
  • 6
  • so you get any error ? try : error_reporting(E_ALL); ini_set('display_errors', '1'); on top of your script in the linux server. – Federico Mar 11 '15 at 12:43
  • 1
    Please check your PHP version on server is it same as your localhost as mysql_real_escape_string this function has be deprecated in newest version of PHP. – Alankar More Mar 11 '15 at 12:44
  • 1
    Please, [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) instead, and use [PDO](http://us1.php.net/pdo). – Jay Blanchard Mar 11 '15 at 12:47
  • @AlankarMore: My PHP Version is 5.3.. – Bharath Mar 11 '15 at 12:51
  • @Federico: i didn't get any error but the content shows not properly . if i stored BHARATH'S but its shows me BHARATH/'s like this – Bharath Mar 11 '15 at 12:53

1 Answers1

0
  • try : on top of your script in the linux server (better before anything else)

    error_reporting(E_ALL); ini_set('display_errors', '1');

  • look in the 'page source code' if a php error is present.

Maybe on the linux yoou need to specify the connection :

$intro = mysql_real_escape_string($_POST["intro"], $my_mysql_connection);
$description = mysql_real_escape_string($_POST["description"], $my_mysql_connection);
  • follow Jay Blanchard suggestion.

Is possible that the php on the linux is running magic_quotes_gpc enabled... Please look in

echo php_info();

if php version < 5.3 and magic_quotes_gpc enabled, try this on top of page:

function stripslashes_recurr($o)
{   $o = is_array($o) ? array_map('stripslashes_recurr', $o) : stripslashes($o);
    return $o;
}

$magic_quotes_gpc = get_magic_quotes_gpc() ? true : false;  
ini_set('magic_quotes_runtime', 0);                             
ini_set('magic_quotes_sybase', 0);
if($magic_quotes_gpc) $_POST = stripslashes_recurr($_POST);
Federico
  • 1,231
  • 9
  • 13
  • Not working .. the descriptions shows like..
    IT

    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt ipsum vel turpis fermentum pulvinar. Suspendisse efficitur nulla nec bibendum vestibulum. Nam sit amet nisi interdum, aliquet urna ut, venenatis augue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque vel rhoncus nulla, et elementum justo.

    – Bharath Mar 11 '15 at 13:56
  • try php_info() for version. – Federico Mar 11 '15 at 14:28
  • Thanks for your query it was working fine what i expected the result. – Bharath Mar 12 '15 at 06:17