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? 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' 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. Link to comment https://forums.phpfreaks.com/topic/53865-solved-searching-for-names/#findComment-266326 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.