0

I can insert the special characters fine when using PHPmyAdmin, but it just doesn't work when inserting them via PHP. Could it be that PHP is changing the special characters into something else? If so, is there a way to make them insert properly?

$name = mysqli_real_escape_string($name); this is not work...
yogesh chatrola
  • 429
  • 4
  • 11

2 Answers2

0

Usage of utf8 in database collation is required for storing the values.

1.) mysql_real_escape_string() - This will avoid up the SQL Injection.

2.) htmlspecialchars - This will prevent XSS attack.

Naresh Kumar P
  • 4,127
  • 2
  • 16
  • 33
  • Also, don't use `mysql_` functions at all - this extension is deprecated in PHP 5.6 and removed in 7.0. – halfer Aug 31 '16 at 19:28
0

You need to escape the quote, like so:

'Women\'s Development & Empowerment, Youth Affairs'
Sarfaraz bheda
  • 457
  • 1
  • 6
  • 23