marcb Posted June 1, 2007 Share Posted June 1, 2007 Hi, I'm having trouble searching my d/b using a person's name when the name includes a '. For example, if I want to run this query: SELECT * FROM people WHERE surname='O'Neal'; This has a bit of a fit as it thinks the ' in O'Neal is the end of the search criteria and then doesn't know what to do with the Neal bit. Am I being a noob? Quote Link to comment https://forums.phpfreaks.com/topic/53865-solved-searching-for-names/ Share on other sites More sharing options...
Barand Posted June 1, 2007 Share Posted June 1, 2007 www.php.net/addslashes() $search = "O'Neal"; $search = addslashes($search); //--> O\'Neal SELECT * FROM people WHERE surname='$search' Quote Link to comment https://forums.phpfreaks.com/topic/53865-solved-searching-for-names/#findComment-266302 Share on other sites More sharing options...
marcb Posted June 1, 2007 Author Share Posted June 1, 2007 Lovely, thanks, that makes life easier. Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/53865-solved-searching-for-names/#findComment-266326 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.