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?
real_escape_stringmethod. Bind the parameters instead.$_POST['foo']is just another variable. It's not special. Just read the entire article, @user3444414. It's worth it.