Dawie Posted November 3, 2003 Share Posted November 3, 2003 Hi, I have a simple table: id surname 1 gastrow 2 gilmer 3 green 4 greenwood 5 gunther (sorted in surname) When the user types in \"gr\" and clicks \"go\" the select statement should return \"green\" and \"greenwood\" I\'m using: \"SELECT * FROM table WHERE surname >= \'$surname\'\" but this also returns \"gunther\" which is incorrect. Anybody with advice please? Thanks Quote Link to comment Share on other sites More sharing options...
theverychap Posted November 3, 2003 Share Posted November 3, 2003 try using LIKE: SELECT * FROM table WHERE surname LIKE \'$surname%\'" or SELECT * FROM table WHERE surname LIKE \'%$surname%\'" Quote Link to comment Share on other sites More sharing options...
Dawie Posted November 4, 2003 Author Share Posted November 4, 2003 Thanks very much!!. Problem solved!. Quote Link to comment Share on other sites More sharing options...
theverychap Posted November 4, 2003 Share Posted November 4, 2003 glad to hear it! no worries... Quote Link to comment 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.