So I'm trying to use this name = $con->real_escape_string($_POST['name']);
with my code, and its not working. I get the error
Fatal error: Call to undefined method PDO::real_escape_string() in /Users/idrisk/Colourity/si/r.php on line 15` I'm not sure what that means. Here's the code I have so far.
$username = "xxx";
$password = "xxx";
try
{
$con = new PDO('mysql:host=localhost;s=myDatabase', $username, $password);
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e)
{
echo 'ERROR: ' . $e->getMessage();
}
$name = $con->real_escape_string($_POST['name']);
$username = $con->real_escape_string($_POST['username']);
$email = $con->real_escape_string($_POST['email']);
$password1 = $con->real_escape_string($_POST['pass1']);
$password2 = $con->real_escape_string($_POST['pass2']);
Any ideas?