Reputation: 33
mysql_real_escape_string()
was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0 ,So what can I do for insert special characters in mysql DB using php 7.0.7
Upvotes: 0
Views: 538
Reputation: 2735
You can insert special character with PDO.Lets take a look with example:
<?php
$conn = new PDO('mysql:host=localhost;dbname=form', $username, $password);
/* Complex string */
$string = "Co'mpl''ex \"st'\"ring";
print "Unquoted string: $string\n";
print "Quoted string: " . $conn->quote($string) . "\n";
?>
Upvotes: 0