DustyP Posted November 14, 2012 Share Posted November 14, 2012 I just received the book and I immediately turned to chapter 18 and I noticed that the escape_data function is no longer being used in the mysqli_connect file. That's disappointing. I noticed however, that much of the same proceedure for working through the POST variables includes pretty much everything the escape_data fucntion from the old book (PHP and MySQL for dynamic websites 2nd edition) used. I tried adding an escape data function to the mysqli_connect file but it threw an immediate error. Unexpected "{" (the first one). I guess this function is no longer good with php 5. function_escape_data($data) { if (ini_get('magic_quotes_gpc')) { $data = stripslashes($data); } global $dbc; $data = mysqli_real_escape_string($dbc, trim($data)); return $data; } Link to comment Share on other sites More sharing options...
Antonio Conte Posted November 14, 2012 Share Posted November 14, 2012 function_escape_data($data) Should be: function escape_data($data) You forgot the space between the function declaration and the function name. 1 Link to comment Share on other sites More sharing options...
DustyP Posted November 14, 2012 Author Share Posted November 14, 2012 Oops. Okay, I'm going to my room now. Thanks. Looking forward to reading the book - the whole book. Link to comment Share on other sites More sharing options...
manthanman Posted January 5, 2013 Share Posted January 5, 2013 I am getting an error when I use escape data function... Fatal error: Call to undefined function escape_data() How can I correct it ? $e=escape_data($_POST['email']); Link to comment Share on other sites More sharing options...
Jonathon Posted January 5, 2013 Share Posted January 5, 2013 Make sure this script has access to the escape_data() function Link to comment Share on other sites More sharing options...
manthanman Posted January 5, 2013 Share Posted January 5, 2013 I am using -MySQL version 5.5.24 -PHP version 5.4.3 -Apache version 2.4.2 P.S I am actually following Larry Ullman's Book: PHP and MySQL: 2nd Edition Link to comment Share on other sites More sharing options...
Jonathon Posted January 5, 2013 Share Posted January 5, 2013 The problem is still the same though. Your script is trying to find a function that it can't access or doesn't exist. Link to comment Share on other sites More sharing options...
Recommended Posts