Riparian Posted April 2, 2009 Share Posted April 2, 2009 Trying to search for mobile numbers in a mysql table eg 123 456789 How do i remove the space between the 3 and 4 in the mysql query I use str_replace in the posted valiable I can use trim() but that is leading and trailing using LIKE does not seem to work Current Query $C_result=mysql_query("select * from clients where (phone LIKE \"%$_POST[PhoneSearch]%\") or (mobile LIKE \"%$_POST[PhoneSearch]%\") ") or die('145'.mysql_error()); Any suggestions greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/152161-help-with-a-search/ Share on other sites More sharing options...
Yesideez Posted April 2, 2009 Share Posted April 2, 2009 Are the spaces stored inside your database or from the user input? Quote Link to comment https://forums.phpfreaks.com/topic/152161-help-with-a-search/#findComment-799253 Share on other sites More sharing options...
fenway Posted April 2, 2009 Share Posted April 2, 2009 mysql has replace(). Quote Link to comment https://forums.phpfreaks.com/topic/152161-help-with-a-search/#findComment-799342 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.