1/31/2024 0 Comments Php string contains apostrophe![]() For example, in MySQL, identifiers are normally delimited by the non-SQL-standards compliant backtick `, while if you configure your database to run in strict mode it uses the SQL-standards compliant double quote ". The reason is that addslashes adds slashes to characters that needs escaping in PHP strings, whereas a DBMS-specific escaping function not only escapes strings for use with that DBMS, but also particularly for the settings for your database, which is why they require a live connection to the database. Should no such function exist, you'd have to write your own. You should, when applicable, use an escape function written for use with your particular DBMS and DB driver, such as mysql_real_escape_string or mysqli_escape_string for mysql. Or whether I should be trying a different way to deal with the apostrophe issue.Īden1 10986761 wrote: $surname=$_POST Īddslashes should NOT be used to sanitize data for use with databases. ![]() I am also wondering whether this approach is secure (if I can get it to work) I don't understand why the addslashes function is working for entering theĭata but the stripslashes function is not working to retrieve the data. O'DonnellError in selection -You have an error in your SQL syntax check the manual that corresponds to your MySQL server version for the right syntax to use near 'Donnell'' at line 2. I have used theīut this gives me the following message when I input the name O'Donnell: However when it comes to using a surname containing an apostropeĪs part of a search query I have a problem. I am trying to solve an apostrophe problem! I have beenĪble, successfully, to insert a surname with an apostrope in it ![]() On advice I have found in forums such as this but without Including trying all sorts of variations in my coding based I have spent hours and hours trying to solve this problem, ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |