I am trying to search through a Field that has the following data in it, basically state abbreviation with zip code data.
The NOTES field is setup as a varchar(75) Record 1 Al GA CA Record 2 FL AL upper Record 3 all others in CA Record 4 CA zip 123456, 456789 The data is passed in a variable from a submit scripts as $terr , let say we are searching for anybody with AL Alabama in there territory. The 3 queries I have tried all return more then I need or nothing at all. Is there a way search a Field that will return only records 1 and record 2 or make the search case sensitive for states and return only records 1 and 2? I am currently using the first query listed. If I use the second query the $ is treated as an expression and not the true variable being passed in from a submit form. $sql = ("select last_name, first_name, phone, email, csr, line, picture, notes, id from address where notes like '%$terr%' " ); $sql = ("select last_name, first_name, phone, email, csr, line, picture, notes, id from address where notes REGEXP BINARY '[$terr]' " ); $sql = ("select last_name, first_name, phone, email, csr, line, picture, notes, id from address where MATCH(notes) AGAINST ('\"$terr\"') " ); Any help would be appreciated. DB = MySql version 3.23.47 Code = PHP 4.2.0 OS = RedHat Larry Sandwick Sarreid, Ltd. Network/System Administrator phone: (252) 291-1414 x223 fax : (252) 237-1592 _____ I am using the free version of SPAMfighter for private users. It has removed 6574 spam emails to date. Paying users do not have this message in their emails. Try SPAMfighter <http://www.spamfighter.com/Product_Info.asp?> for free now!