this.user Posted August 26, 2010 Share Posted August 26, 2010 how do i search a table row, lets say Names for any names that do not start with any letter a-zA-Z? also is LIKE the best use for this type of searhc? Quote Link to comment https://forums.phpfreaks.com/topic/211784-search-database/ Share on other sites More sharing options...
dgoosens Posted August 26, 2010 Share Posted August 26, 2010 have a look at regular expressions http://dev.mysql.com/doc/refman/5.1/en/regexp.html something like: SELECT column FROM table WHERE column REGEXP '^[[:alpha:]]' Quote Link to comment https://forums.phpfreaks.com/topic/211784-search-database/#findComment-1103952 Share on other sites More sharing options...
sohaibshaheen Posted August 29, 2010 Share Posted August 29, 2010 how do i search a table row, lets say Names for any names that do not start with any letter a-zA-Z? also is LIKE the best use for this type of searhc? This is what you exactly need!! $result = mysql_query(" SELECT * FROM table WHERE column NOT REGEXP '^[a-z]' ") or die(mysql_error()); If I am not wrong! As far as I tested this is case insensitive match so a-z and A-Z are same! Quote Link to comment https://forums.phpfreaks.com/topic/211784-search-database/#findComment-1104773 Share on other sites More sharing options...
dgoosens Posted August 30, 2010 Share Posted August 30, 2010 If I am not wrong! As far as I tested this is case insensitive match so a-z and A-Z are same! This depends on the table and its collation: http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html Quote Link to comment https://forums.phpfreaks.com/topic/211784-search-database/#findComment-1105181 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.